:root {
    --primary-bg: #121212;
    --secondary-bg: #1a1a1a;
    --card-bg: #232323;
    --header-bg: #1e4d92;
    --text-color: #f0f0f0;
    --accent-color: #3182ce;
    --accent-hover: #2b6cb0;
    --muted-text: #9e9e9e;
    --border-color: #333333;
    --success-color: #38a169;
    --warning-color: #dd6b20;
    --danger-color: #e53e3e;
    --info-color: #4299e1;
}

body {
    background-color: var(--primary-bg);
    color: var(--text-color);
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Wrapper and Layout */
.wrapper_new {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.page-wrapper_new {
    background-color: var(--primary-bg);
    padding: 0;
    width: calc(100% - 220px);
    margin-left: 220px;
    /* Exact sidebar width */
    min-height: 100vh;
    position: relative;
}



/* Navigation */

.page-title-container_new {
    background: var(--secondary-bg);
    color: var(--text-color);
    padding: 15px 20px;
    margin: 0 0 20px 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 0;
    height: 80px;
}

.page-title_new {
    margin: 0;
    font-size: 24px;
    /*  Adjust font size if needed  */
}

/* Style for the logo container */
.logo-container_new {
    display: flex;
    align-items: center;
    height: 100%;
    /*  Make sure logo container is the same height as parent */
}

/* Logo Style */
.header-logo_new {
    height: 150px;
    /* Adjust to desired logo height */
    width: auto;
    margin-right: 25px;
    object-fit: contain;
    max-width: 200px;
}


/* Dashboard Content */
.graphs_new {
    padding: 0;
}

.highlight {
    color: var(--primary);
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-title_new {
    background: linear-gradient(to right, #121212, #1a1a2e, #121212);
    color: #ffffff;
    padding: 15px 20px;
    margin: 0 0 20px 0;
    font-weight: 500;
    font-size: 24px;
    text-align: left;
    border-bottom: 2px solid #9d4edd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dashboard-open-link {
    position: absolute;
    top: 10px;
    /* Moved higher to avoid overlapping graph content */
    right: 10px;
    /* Moved closer to edge to save space */
    z-index: 10;
    transform: translateZ(0);
    -webkit-font-smoothing: antialiased;
}

.dashboard-open-button {
    background: linear-gradient(135deg, #9d4edd 0%, #7b2cbf 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: inline-block;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.dashboard-open-button:hover {
    background: rgba(157, 78, 221, 1);
    /* Full opacity on hover */
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
    /* Slight lift effect on hover */
}

.dashboard-open-button::after {
    content: "↗";
    margin-left: 6px;
    font-size: 14px;
}

.filter-container_new {
    background-color: var(--card-bg);
    padding: 15px;
    margin: 0 20px 20px;
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-group_new {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-label_new {
    color: var(--muted-text);
    font-size: 13px;
    font-weight: 500;
    margin: 0;
}

.filter-select_new {
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--text-color);
    font-size: 14px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-width: 140px;
    outline: none;
    height: 34px;
}


.filter-select_new:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px rgba(49, 130, 206, 0.2);
}

.datepicker-container_new {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}




.datepicker_new {
    background-color: var(--secondary-bg);
    /* Match the surrounding elements */
    color: var(--text-color);
    /* Make the text clearly visible */
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 13px;
    width: 120px;
    text-align: center;
    outline: none;
    height: 34px;
}

.datepicker_new:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px rgba(49, 130, 206, 0.2);
}

/* Dashboard Cards */
.dashboard-content_new {
    padding: 0 20px;
    border-radius: 12px;
}

.dashboard-row_new {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}




.dashboard-card_new {
    background-color: var(--card-bg);
    border-radius: 4px;
    flex: 1;
    min-width: 100px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    height: 180px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.graph-card_new {
    background-color: var(--card-bg);
    border-radius: 4px;
    flex: 1;
    min-width: 100px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    height: 150px;
    display: flex;
    flex-direction: column;
}




.dashboard-card_new.small {
    height: 150px;
}

.card-iframe_new {
    width: 100%;
    height: 100%;
    border: none;
    background-color: transparent;
}


.dashboard-content_new:hover {
    box-shadow: 0 4px 8px rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}


/* Footer */
.footer_new {
    background-color: var(--secondary-bg);
    padding: 12px 15px;
    text-align: center;
    color: var(--muted-text);
    font-size: 12px;
    margin: 15px 20px;
    border-radius: 4px;
}

.footer_new a {
    color: var(--accent-color);
    text-decoration: none;
}

.footer_new a:hover {
    text-decoration: underline;
}

/* Loader Overlay */
.loader-overlay_new {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader_new {
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top: 5px solid var(--accent-color);
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 992px) {
    .sidebar_new {
        width: 60px;
    }

    .nav_new>li>a span {
        display: none;
    }

    .page-wrapper_new {
        margin-left: 60px;
        width: calc(100% - 60px);
    }

    .navbar-brand_new {
        font-size: 0;
        padding: 15px 0;
        justify-content: center;
    }

    .navbar-brand_new i {
        margin-right: 0;
        font-size: 22px;
    }
}

@media (max-width: 768px) {
    .dashboard-row_new {
        flex-direction: column;
    }

    .dashboard-card_new {
        min-width: 100%;
    }

    .datepicker-container_new {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    .filter-container_new {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-group_new {
        width: 100%;
    }

    .filter-select_new {
        flex-grow: 1;
    }
}

.ui-datepicker {
    background-color: red;
    color: purple;
    border: 1px solid var(--border-color) !important;
    border-radius: 4px !important;
    padding: 8px !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2) !important;
    font-size: 13px !important;
}

.ui-datepicker-header {
    background-color: red;
    color: purple;
    border: none !important;
    border-radius: 3px !important;
    padding: 6px !important;
}

.ui-datepicker-prev,
.ui-datepicker-next {
    background-color: transparent !important;
    cursor: pointer !important;
    color: var(--accent-color) !important;
}

.ui-datepicker-calendar th {
    color: var(--muted-text) !important;
}

.ui-datepicker-calendar td a {
    background-color: purple;
    /* Set standard background */
    color: black;
    /* Set the correct text color */
    border: none !important;
    border-radius: 3px !important;
    text-align: center !important;
}

.ui-datepicker-calendar td a:hover {
    background-color: var(--accent-color) !important;
    /* Highlight on hover */
    color: white !important;
}

.ui-datepicker-current-day a {
    background-color: var(--accent-color) !important;
    /* Style the current day */
    color: white !important;
}

.ui-datepicker-unselectable .ui-state-default {
    color: var(--muted-text) !important;
    /* Style unselectable dates */
    background: var(--secondary-bg) !important;
}

/* Optimize iframe loading */
.lazy-iframe_new {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.lazy-iframe_new.loaded {
    opacity: 1;
}

.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Roboto', sans-serif;
}

.chatbot-toggle-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6a11cb 0%, #bf98ce 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
}

.chatbot-toggle-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.chatbot-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    height: 500px;
    background-color: #1d1e22;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(0);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.chatbot-panel.expanded {
    width: 900px;
    height: 600px;
    bottom: 50px;
    right: 50px;
}


.chatbot-panel.active {
    transform: scale(1);
    opacity: 1;
}

.chatbot-header {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    padding: 15px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}


.header-actions {
    display: flex;
    gap: 8px;
}

.expand-button {
    background: transparent;
    color: white;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 28px;
    height: 28px;
    border-radius: 4px;
}

.expand-button:hover {
    transform: scale(1.2);
    background: rgba(255, 255, 255, 0.1);
}

.logo-container {
    display: flex;
    align-items: center;
}

.chatbot-logo {
    height: 24px;
    margin-right: 10px;
}

.close-button {
    background: transparent;
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 28px;
    height: 28px;
    border-radius: 4px;
}

.close-button:hover {
    transform: scale(1.2);
    background: rgba(255, 255, 255, 0.1);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    background-color: #1d1e22;
    scrollbar-width: thin;
    scrollbar-color: #6a11cb #1d1e22;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #1d1e22;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background-color: #6a11cb;
    border-radius: 20px;
}

.user-message,
.bot-message {
    max-width: 80%;
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 18px;
    position: relative;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.user-message {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.bot-message {
    background-color: #2d2e36;
    color: #f0f0f0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message-content {
    margin-bottom: 5px;
    white-space: pre-line;
    /* Preserves line breaks and spaces */
    line-height: 1.6;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;


}

.message-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    text-align: right;
}

.chatbot-input {
    display: flex;
    padding: 12px;
    background-color: #2d2e36;
    border-top: 1px solid #3a3b45;
}

.chatbot-input input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #3a3b45;
    border-radius: 24px;
    margin-right: 10px;
    background-color: #1d1e22;
    color: #f0f0f0;
    font-size: 14px;
    transition: all 0.3s ease;
}

.chatbot-input input:focus {
    outline: none;
    border-color: #6a11cb;
    box-shadow: 0 0 0 2px rgba(106, 17, 203, 0.3);
}

.chatbot-input button {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chatbot-input button:hover {
    transform: scale(1.1);
}

.chatbot-input button:disabled {
    background: #3a3b45;
    cursor: not-allowed;
    transform: scale(1);
}

/* Responsive styles */
@media (max-width: 768px) {
    .chatbot-panel {
        width: 90vw;
        height: 70vh;
        bottom: 80px;
        right: 5vw;
    }

    .chatbot-toggle-button {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .chatbot-container {
        bottom: 15px;
        right: 15px;
    }
}

@media (max-width: 480px) {
    .chatbot-panel {
        width: 100vw;
        height: 80vh;
        bottom: 70px;
        right: 0;
        border-radius: 12px 12px 0 0;
    }
}


@media (max-width: 768px) {
    .chatbot-panel.expanded {
        width: 95vw;
        height: 85vh;
        bottom: 10px;
        right: 2.5vw;
    }
}

@media (max-width: 480px) {
    .chatbot-panel.expanded {
        width: 100vw;
        height: 90vh;
        bottom: 0;
        right: 0;
        border-radius: 12px 12px 0 0;
    }
}


.message-content .product-code {
    background-color: rgba(106, 17, 203, 0.2);
    color: #bf98ce;
    padding: 1px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: 500;
}

.message-content .amount {
    color: #2575fc;
    font-weight: 600;
}

.bot-message .message-content {
    line-height: 1.6;
}






.card-header_new {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.card-header_new h3 {
    margin: 0;
    font-size: 18px;
    color: #d8d9e3;
}

.card-body_new {
    padding: 10px 0;
}

.metric-value {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

.metric-trend {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.metric-trend.positive {
    color: #4CAF50;
}

.metric-trend.negative {
    color: #F44336;
}

.metric-info {
    font-size: 14px;
    color: #aaa;
    margin-top: 5px;
}

.card-chart_new {
    height: 80px;
    margin-top: auto;
}

.chart-container_new {
    display: flex;
    flex-direction: column;
    height: 150px;
    margin-top: auto;
}

.trend-chart {
    width: 100%;
    height: 100%;
}

.bar-chart {
    width: 100%;
    height: 100%;
}

.pie-chart-container {
    width: 150px;
    height: 150px;
    margin: 0 auto;
}

.pie-chart {
    width: 100%;
    height: 100%;
}

.pie-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 12px;
}

.color-box {
    width: 12px;
    height: 12px;
    margin-right: 5px;
    border-radius: 2px;
}

.comparison-container {
    display: flex;
    justify-content: space-around;
}

.comparison-item {
    text-align: center;
}

.comparison-label {
    font-size: 14px;
    color: #aaa;
}

.comparison-value {
    font-size: 18px;
    font-weight: bold;
}

.comparison-value.positive {
    color: #4CAF50;
}

.comparison-value.negative {
    color: #F44336;
}

.comparison-chart {
    width: 100%;
    height: 100%;
}





.section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #fff;
    text-align: center;
}

.dummy-cards-container {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.dummy-card {
    flex: 1;
    min-width: 200px;
    background: linear-gradient(145deg, #1e1e1e, #292929);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(128, 0, 128, 0.1);
    height: 150px;
}

.dummy-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(138, 43, 226, 0.2);
}

.dummy-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #6f538a, #2e2d2d);
}

.dummy-card-title {
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: #a970ff;
    display: flex;
    align-items: center;
}

.dummy-card-title svg {
    margin-right: 0.5rem;
}

.dummy-card-number {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, #9c27b0, #673ab7);
    -webkit-background-clip: text;
    background-clip: text;
    color: white;
}

.dummy-card-description {
    font-size: 0.875rem;
    color: #bbbbbb;
    margin-bottom: 1rem;
}

.dummy-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #888;
}

.dummy-card-trend {
    display: flex;
    align-items: center;
}

.trend-up {
    color: #4caf50;
}

.trend-down {
    color: #f44336;
}

.dummy-card-status {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 12px;
    background-color: rgba(138, 43, 226, 0.1);
    color: #a970ff;
    font-weight: 500;
}





.card {
    background: #1E1E1E;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 20px;
    transition: var(--transition);
    border: 1px solid #333;
    margin-bottom: 20px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 25px rgba(108, 99, 255, 0.2);
    border-color: var(--primary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--light);
}

.card-actions {
    display: flex;
    gap: 10px;
}

.card-action {
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.card-action:hover {
    color: var(--primary);
}

.card-body {
    position: relative;
    max-height: 250px;
}

.cash-flow-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 30px;
}

.cash-flow-label {
    font-size: 1.2rem;
    color: var(--gray);
    margin-bottom: 15px;
}

.cash-flow-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
    text-align: center;
}

.cash-flow-trend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1rem;
}

.cash-flow-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 15px;
}

.cash-flow-positive {
    color: var(--success);
}

.cash-flow-negative {
    color: var(--danger);
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
}

.span-6 {
    grid-column: span 6;
}

.span-4 {
    grid-column: span 4;
}

@media (max-width: 1200px) {

    .span-6,
    .span-4 {
        grid-column: span 6;
    }
}

@media (max-width: 768px) {

    .span-6,
    .span-4 {
        grid-column: span 12;
    }
}


.dashboard-card {
    margin: 20px 0;
    /* background: linear-gradient(135deg, #0d1117 0%, #4f565f 100%); */
    border-radius: 12px;
    padding: 8px;
    /* This padding affects where sticky elements start */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(173, 25, 25, 0.08);

    /* For Scrollability */
    max-height: 650px;
    /* IMPORTANT: Adjust this to your desired card height */
    overflow-y: auto;
    /* Enable vertical scrolling */

    /* Scrollbar styling for Webkit browsers (Chrome, Safari, Edge) */
    scrollbar-width: thin;
    /* For Firefox */
    scrollbar-color: #888 #333;
    /* For Firefox: thumb color / track color */
}

.dashboard-card::-webkit-scrollbar {
    width: 8px;
}

.dashboard-card::-webkit-scrollbar-track {
    background: #333;
    border-radius: 10px;
}

.dashboard-card::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.dashboard-card::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* New or updated CSS for the sticky header */
.profitability-dark-header {
    /* Your existing header styles might go here */
    background: #0d1117;
    /* Ensure it has a background to cover content below */
    padding: 15px 8px;
    /* Adjust padding to match the card's aesthetic */
    margin: -8px -8px 0 -8px;
    /* Compensate for the .dashboard-card's padding */
    border-top-left-radius: 12px;
    /* Maintain the card's rounded corners */
    border-top-right-radius: 12px;
    border-bottom: 1px solid #444;
    /* Optional: adds a subtle separator */

    /* Make it sticky */
    position: sticky;
    top: 0;
    /* Sticks to the very top of the scrollable .dashboard-card */
    z-index: 10;
    /* Ensures it stays above other content when scrolling */
}

/* Styles for the month filter container if it should also be sticky (optional) */
.profitability-month-filter {
    background: #0d1117;
    /* Match header background if it should be part of the fixed area */
    padding: 10px 8px;
    /* Adjust as needed */
    margin: 0 -8px;
    /* Compensate for card padding */
    border-bottom: 1px solid #444;
    /* Optional separator */

    position: sticky;
    /* Make the filter stick */
    top: 60px;
    /* Adjust this value: it should be the height of the .profitability-dark-header + its padding/margin */
    z-index: 9;
    /* Slightly lower than header but still above scrolling content */
}

/* revenue */

.revenue-dark-container {
    margin: 20px 0;
    background: linear-gradient(135deg, #0d1117 0%, #4f565f 100%);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(173, 25, 25, 0.08);
}

.revenue-dark-card {
    background: rgba(33, 38, 45, 0.8);
    border-radius: 12px;
    overflow: hidden;
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.revenue-dark-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #21262d 0%, #30363d 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.revenue-dark-title {
    color: #f0f6fc;
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.revenue-dark-content {
    padding: 12px;
    position: relative;
}

.table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 8px;
    background: rgba(13, 17, 23, 0.6);
}

.table-container::-webkit-scrollbar {
    width: 6px;
}

.table-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.revenue-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}

.revenue-table th {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #21262d 0%, #30363d 100%);
    z-index: 10;
    backdrop-filter: blur(8px);
}

.revenue-table th,
.revenue-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: #e6edf3;
    font-size: 14px;
}

.revenue-table th {
    font-weight: 600;
    color: #f0f6fc;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.revenue-table tr:hover {
    background: rgba(255, 255, 255, 0.04);
    transition: background-color 0.2s ease;
}

.submit-section {
    position: sticky;
    bottom: 0;
    background: linear-gradient(135deg, rgba(33, 38, 45, 0.95) 0%, rgba(22, 27, 34, 0.95) 100%);
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    backdrop-filter: blur(12px);
}

.budget-input {
    background: rgba(13, 17, 23, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f0f6fc;
    padding: 10px 12px;
    border-radius: 8px;
    width: 120px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.budget-input:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
    background: rgba(13, 17, 23, 0.9);
}

.variation-positive {
    color: #3fb950;
    font-weight: 600;
}

.variation-negative {
    color: #f85149;
    font-weight: 600;
}

.variation-neutral {
    color: #8b949e;
}

.submit-button {
    background: linear-gradient(135deg, #425a98 0%, #564fa2 100%);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 80px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.submit-button:hover {
    background: linear-gradient(135deg, #183ac3 0%, #3a2386 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 160, 67, 0.3);
}

.submit-button:active {
    transform: translateY(0);
}

.submit-button:disabled {
    background: rgba(110, 118, 129, 0.4);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.revenue-dark-loading {
    text-align: center;
    color: #8b949e;
    padding: 24px;
    font-size: 14px;
}

.revenue-dark-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: #58a6ff;
    animation: spin 1s linear infinite;
    margin-bottom: 8px;
}

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

.success-message {
    background: linear-gradient(135deg, rgba(46, 160, 67, 0.15) 0%, rgba(35, 134, 54, 0.15) 100%);
    color: #3fb950;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 8px 0;
    border: 1px solid rgba(46, 160, 67, 0.2);
    font-size: 14px;
}

.error-message {
    background: linear-gradient(135deg, rgba(248, 81, 73, 0.15) 0%, rgba(218, 54, 51, 0.15) 100%);
    color: #f85149;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 8px 0;
    border: 1px solid rgba(248, 81, 73, 0.2);
    font-size: 14px;
}



.month-range-filters {
    margin: 16px 0;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border: 1px solid #333;
    border-radius: 12px;
    overflow: hidden;
    min-height: 80px;
    /* Prevent shrinking */
}

.filter-container {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    flex-wrap: wrap;
    min-height: 48px;
    /* Maintain consistent height */
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    /* Prevent shrinking */
    min-width: 140px;
}

.filter-group label {
    color: #e0e0e0;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    white-space: nowrap;
}

.month-input {
    background: #333;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 10px 12px;
    color: #fff;
    font-size: 14px;
    width: 140px;
    height: 40px;
    /* Fixed height */
    box-sizing: border-box;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.month-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
    background: #3a3a3a;
    transform: none;
    /* Prevent transform on focus */
}

.month-input:hover {
    border-color: #555;
    background: #3a3a3a;
}

.filter-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.filter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 40px;
    /* Match input height */
    box-sizing: border-box;
    white-space: nowrap;
    min-width: 80px;
}

.filter-btn:hover {
    transform: translateY(-1px);
}

.filter-btn:active {
    transform: translateY(0);
}

.filter-btn.primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
}

.filter-btn.primary:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
}

.filter-btn.secondary {
    background: #444;
    color: #e0e0e0;
    border: 1px solid #555;
}

.filter-btn.secondary:hover {
    background: #555;
    color: #fff;
}

/* Summary Card - Fixed Layout */
.summary-card {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border: 1px solid #333;
    border-radius: 12px;
    margin-bottom: 24px;
    overflow: hidden;
    min-height: 120px;
    /* Prevent shrinking */
}

.summary-header {
    background: linear-gradient(135deg, #333 0%, #444 100%);
    padding: 16px 20px;
    border-bottom: 1px solid #444;
    min-height: 24px;
}

.summary-header h4 {
    margin: 0;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;
    min-height: 80px;
}

.summary-metric {
    text-align: center;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.metric-label {
    color: #999;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.metric-value {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    line-height: 1.2;
}

.metric-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.status-badge {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* Variation Colors */
.variation-positive {
    color: #28a745;
}

.variation-negative {
    color: #dc3545;
}

.variation-neutral {
    color: #6c757d;
}

.status-on-track {
    color: #28a745;
}

/* Responsive Design - Fixed */
@media (max-width: 768px) {
    .filter-container {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 20px;
    }

    .filter-group {
        min-width: 100%;
    }

    .month-input {
        width: 100%;
    }

    .filter-actions {
        margin-left: 0;
        justify-content: center;
        width: 100%;
    }

    .filter-btn {
        flex: 1;
        min-width: 0;
    }

    .summary-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px;
    }

    .summary-metric {
        min-height: 50px;
    }

    .metric-value {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .filter-container {
        padding: 16px;
    }

    .metric-value {
        font-size: 16px;
    }

    .filter-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* Prevent layout shift during interactions */
.month-range-filters *,
.summary-card * {
    box-sizing: border-box;
}

/* Smooth transitions for better UX */
.filter-container,
.summary-card,
.month-input,
.filter-btn {
    transition: all 0.2s ease;
}


.popup-overlay {
    display: none;
    /* Hidden by default */
    position: fixed;
    /* Stay in place */
    z-index: 1000;
    /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    /* Full width */
    height: 100%;
    /* Full height */
    overflow: auto;
    /* Enable scroll if needed */
    background-color: rgba(0, 0, 0, 0.7);
    /* Black w/ opacity */
    justify-content: center;
    align-items: center;
}

.popup-content {
    background-color: #1a1a1a;
    /* Darker background to match theme */
    border-radius: 12px;
    /* Softer rounded corners */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8);
    /* More pronounced, darker shadow */
    padding: 5px;
    /* Slightly more padding */
    width: 90%;
    /* A bit wider for better responsiveness on larger screens */
    max-width: 1200px;
    /* Max width to prevent it from getting too large on huge screens */
    height: 90%;
    /* Take up more height */
    max-height: 90vh;
    /* Max height based on viewport height */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Hide any overflow within the content */

    /* subtle gradient border for a modern touch */
    border: 1px solid transparent;
    background-image: linear-gradient(#1a1a1a, #1a1a1a), linear-gradient(to right, #4a4a4a, #888);
    /* Background & Border Gradient */
    background-origin: border-box;
    background-clip: content-box, border-box;

    transform: scale(0.9);
    /* Start slightly smaller for subtle animation */
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;

}

.popup-content iframe {
    width: 100%;
    height: 100%;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    align-self: flex-end;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.dashboard-popup-button {
    position: absolute;
    top: 10px;
    right: 50px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    padding: 8px;
    cursor: pointer;
    font-size: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.dashboard-popup-button:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Make sure the card has relative positioning for absolute buttons */
.graph-card_new {
    position: relative;
}


.dashboard-external-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    padding: 8px;
    cursor: pointer;
    font-size: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    text-decoration: none;
}

.dashboard-external-button:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
    color: white;
    text-decoration: none;
}



.chart-container {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    height: 400px;
    width: 600px;
}

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




.graphs-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 5px;
    margin-top: 20px;
}

.graph-card_new {
    background: #1e1e1e;
    border-radius: 8px;
    padding: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
}

.graph-title {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
}

.alert-box {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: white;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.alert-count {
    font-size: 2em;
    margin-bottom: 5px;
}
