/* =========================================================
   FINANCE DASHBOARD
========================================================= */

.finance-dashboard {
    width: 100%;
    min-width: 0;

    display: flex;
    flex-direction: column;

    gap: 14px;

    padding-bottom: 20px;

    box-sizing: border-box;
}

.finance-dashboard *,
.finance-dashboard *::before,
.finance-dashboard *::after {
    box-sizing: border-box;
}


/* =========================================================
   DASHBOARD GRID
========================================================= */

.dashboard-row {
    width: 100%;
    min-width: 0;

    display: grid;

    grid-template-columns: repeat(12, minmax(0, 1fr));

    gap: 14px;

    align-items: stretch;
}


/* 12 COLUMN */

.dashboard-col-12 {
    grid-column: span 12;

    width: 100%;
    min-width: 0;
}


/* 8 COLUMN */

.dashboard-col-8 {
    grid-column: span 8;

    width: 100%;
    min-width: 0;
}


/* 6 COLUMN */

.dashboard-col-6 {
    grid-column: span 6;

    width: 100%;
    min-width: 0;
}


/* 4 COLUMN */

.dashboard-col-4 {
    grid-column: span 4;

    width: 100%;
    min-width: 0;
}


/* 3 COLUMN */

.dashboard-col-3 {
    grid-column: span 3;

    width: 100%;
    min-width: 0;
}


/* =========================================================
   SCENE / MAIN CARD
========================================================= */

.scene {
    width: 100%;
    min-width: 0;
    max-width: 100%;

    background: #111827;

    border: 1px solid #1F2937;

    border-radius: 14px;

    padding: 16px;

    overflow: hidden;

    box-shadow:
        0 2px 6px rgba(15, 23, 42, .03),
        0 8px 20px rgba(15, 23, 42, .04);

    transition:
        transform .2s ease,
        box-shadow .2s ease,
        border-color .2s ease;
}


.scene:hover {
    transform: translateY(-1px);

    box-shadow:
        0 6px 18px rgba(15, 23, 42, .08);
}


/* =========================================================
   SCENE HEADER
========================================================= */

.scene-header {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 12px;

    margin-bottom: 16px;
}


.scene-title {
    min-width: 0;
}


.scene-title h3 {
    margin: 0;

    color: #F8FAFC;

    font-size: 20px;
    font-weight: 700;

    line-height: 1.25;
}


.scene-title p {
    margin: 4px 0 0;

    color: #64748B;

    font-size: 13px;

    line-height: 1.4;
}


.scene-toolbar {
    display: flex;

    align-items: center;

    gap: 8px;

    flex-shrink: 0;
}


/* =========================================================
   DASHBOARD NAVIGATION
========================================================= */

.dashboard-nav {
    width: 100%;
    min-width: 0;

    background: #FFFFFF;

    border: 1px solid #E2E8F0;

    border-radius: 12px;

    padding: 6px;

    display: flex;

    align-items: center;

    gap: 6px;

    overflow-x: auto;
    overflow-y: hidden;

    scrollbar-width: thin;
    scrollbar-color: #64748B transparent;
}


/* NAV ITEM */

.dashboard-nav a {
    min-width: 0;
    min-height: 38px;

    display: flex;

    align-items: center;
    justify-content: center;

    gap: 7px;

    padding: 8px 14px;

    border-radius: 8px;

    color: #64748B;

    font-size: 13px;
    font-weight: 600;

    line-height: 1.2;

    text-decoration: none;

    white-space: nowrap;

    transition:
        background .2s ease,
        color .2s ease;
}


/* NAV ICON */

.dashboard-nav a i {
    width: 16px;

    flex-shrink: 0;

    text-align: center;

    font-size: 13px;
}


/* NAV HOVER */

.dashboard-nav a:hover {
    background: #F1F5F9;

    color: #334155;

    text-decoration: none;
}


/* NAV ACTIVE */

.dashboard-nav a.active {
    background: #2563EB;

    color: #FFFFFF;
}


/* NAV SCROLLBAR */

.dashboard-nav::-webkit-scrollbar {
    height: 4px;
}


.dashboard-nav::-webkit-scrollbar-track {
    background: transparent;
}


.dashboard-nav::-webkit-scrollbar-thumb {
    background: #64748B;

    border-radius: 10px;
}


/* =========================================================
   CHART PLACEHOLDER
========================================================= */

.chart-placeholder {
    width: 100%;
    height: 260px;

    border-radius: 12px;

    border: 1px dashed #334155;

    background: #0F172A;

    display: flex;

    justify-content: center;
    align-items: center;

    color: #94A3B8;

    font-size: 13px;
    font-weight: 600;
}


/* =========================================================
   MINI GRID
========================================================= */

.mini-grid {
    width: 100%;

    display: grid;

    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 10px;

    margin-top: 12px;
}


/* =========================================================
   MINI CARD
========================================================= */

.mini-card {
    min-width: 0;

    background: #1E293B;

    border: 1px solid #334155;

    border-radius: 10px;

    padding: 12px;
}


.mini-card label {
    display: block;

    margin: 0;

    color: #94A3B8;

    font-size: 11px;
    font-weight: 500;
}


.mini-card strong {
    display: block;

    margin-top: 5px;

    color: #F8FAFC;

    font-size: 17px;
    font-weight: 700;

    line-height: 1.25;
}


/* =========================================================
   AI INSIGHT
========================================================= */

.insight-grid {
    width: 100%;

    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 14px;
}


.insight-card {
    min-width: 0;

    background: #1E293B;

    border: 1px solid #334155;

    border-radius: 12px;

    padding: 16px;

    transition:
        border-color .2s ease,
        transform .2s ease;
}


.insight-card:hover {
    border-color: #3B82F6;

    transform: translateY(-2px);
}


/* AI SUMMARY */

.ai-summary {
    border-top: 3px solid #3B82F6;
}


/* RECOMMENDATION */

.recommendation {
    border-top: 3px solid #22C55E;
}


/* =========================================================
   AI HIGHLIGHT
========================================================= */

.highlight {
    text-align: center;

    margin: 16px 0;
}


.highlight h4 {
    margin: 0 0 6px;

    color: #F8FAFC;

    font-size: 14px;
    font-weight: 600;
}


.highlight-value {
    color: #3B82F6;

    font-size: 26px;
    font-weight: 700;

    line-height: 1.2;
}


/* =========================================================
   AI MINI GRID
========================================================= */

.insight-card .mini-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 10px;

    margin-top: 12px;
}


.insight-card .mini-grid > div {
    min-width: 0;

    background: #0F172A;

    border-radius: 8px;

    padding: 10px;

    text-align: center;
}


.insight-card .mini-grid span {
    display: block;

    margin-bottom: 4px;

    color: #94A3B8;

    font-size: 10px;
}


.insight-card .mini-grid strong {
    color: #F8FAFC;

    font-size: 16px;
    font-weight: 700;
}


/* =========================================================
   INSIGHT LIST
========================================================= */

.insight-list,
.recommendation-list {
    list-style: none;

    padding: 0;

    margin: 0;
}


.insight-list li,
.recommendation-list li {
    padding: 9px 0;

    border-bottom: 1px solid #334155;

    color: #CBD5E1;

    font-size: 12px;

    line-height: 1.5;
}


.insight-list li:last-child,
.recommendation-list li:last-child {
    border-bottom: none;
}


/* =========================================================
   EXPENSE + BUSINESS LAYOUT
========================================================= */

.dashboard-row-finance {
    width: 100%;
    min-width: 0;

    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 14px;

    align-items: stretch;
}


/* HALF COLUMN */

.dashboard-finance-half {
    width: 100%;
    min-width: 0;
    max-width: 100%;

    overflow: hidden;
}


/* SCENE INSIDE HALF */

.dashboard-finance-half > .scene {
    width: 100%;
    min-width: 0;
    max-width: 100%;

    height: 100%;

    box-sizing: border-box;
}


/* PREVENT CHILD OVERFLOW */

.dashboard-finance-half * {
    box-sizing: border-box;

    min-width: 0;
}


/* =========================================================
   GENERAL OVERFLOW PROTECTION
========================================================= */

.finance-dashboard section,
.finance-dashboard .scene,
.finance-dashboard .dashboard-row,
.finance-dashboard .dashboard-col-12,
.finance-dashboard .dashboard-col-8,
.finance-dashboard .dashboard-col-6,
.finance-dashboard .dashboard-col-4,
.finance-dashboard .dashboard-col-3 {
    min-width: 0;
    max-width: 100%;
}


/* CHART CONTAINER */

.finance-dashboard canvas,
.finance-dashboard svg {
    max-width: 100%;
}


/* =========================================================
   TABLE PROTECTION
========================================================= */

.finance-dashboard .table-responsive {
    width: 100%;

    overflow-x: auto;
}


/* =========================================================
   DESKTOP MEDIUM
========================================================= */

@media (max-width: 1450px) {

    .dashboard-row-finance {
        grid-template-columns: 1fr;
    }

}


/* =========================================================
   TABLET / SMALL DESKTOP
========================================================= */

@media (max-width: 1200px) {

    .dashboard-col-8,
    .dashboard-col-6,
    .dashboard-col-4 {
        grid-column: span 12;
    }


    .insight-grid {
        grid-template-columns: 1fr;
    }


    .mini-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 992px) {

    .finance-dashboard {
        gap: 12px;
    }


    .dashboard-row {
        gap: 12px;
    }


    .scene {
        padding: 14px;

        border-radius: 12px;
    }


    .scene-title h3 {
        font-size: 18px;
    }


    .dashboard-nav {
        justify-content: flex-start;
    }


    .dashboard-nav a {
        flex: 0 0 auto;
    }

}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 768px) {

    .finance-dashboard {
        gap: 10px;

        padding-bottom: 15px;
    }


    .dashboard-row {
        display: block;
    }


    .dashboard-row > * {
        margin-bottom: 10px;
    }


    .dashboard-row > *:last-child {
        margin-bottom: 0;
    }


    .scene {
        padding: 12px;

        border-radius: 10px;
    }


    .scene-header {
        align-items: flex-start;

        margin-bottom: 12px;
    }


    .scene-title h3 {
        font-size: 17px;
    }


    .scene-title p {
        font-size: 11px;
    }


    .dashboard-nav {
        padding: 5px;

        gap: 4px;

        border-radius: 10px;
    }


    .dashboard-nav a {
        min-height: 34px;

        padding: 7px 11px;

        gap: 6px;

        border-radius: 7px;

        font-size: 12px;
    }


    .dashboard-nav a i {
        width: 14px;

        font-size: 12px;
    }


    .mini-grid {
        grid-template-columns: 1fr;

        gap: 8px;
    }


    .insight-grid {
        grid-template-columns: 1fr;

        gap: 10px;
    }


    .chart-placeholder {
        height: 220px;
    }

}


/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 576px) {

    .scene {
        padding: 10px;
    }


    .scene-header {
        flex-direction: column;

        gap: 8px;
    }


    .scene-toolbar {
        width: 100%;

        flex-wrap: wrap;
    }


    .scene-title h3 {
        font-size: 16px;
    }


    .dashboard-nav a {
        padding: 6px 10px;

        font-size: 11px;
    }


    .mini-card {
        padding: 10px;
    }


    .mini-card strong {
        font-size: 15px;
    }


    .highlight-value {
        font-size: 22px;
    }

}