/* Dashboard Grid & Layout */
.dashboard-container {
    display: flex;
    height: calc(100vh - 78px);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.sidebar {
    width: 270px;
    background: rgba(18, 21, 28, 0.95);
    border-right: 1px solid var(--border-color);
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
    box-sizing: border-box;
    overflow-y: auto;
    height: 100%;
}

.sidebar-header {
    width: 100%;
    box-sizing: border-box;
}

.sidebar-nav-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    box-sizing: border-box;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    width: 100%;
    line-height: 1.35;
    word-break: break-word;
}

.sidebar-nav-item .svg-icon {
    flex-shrink: 0;
}

.sidebar-nav-item:hover, .sidebar-nav-item.active {
    background: var(--primary-light);
    color: #FFFFFF;
    font-weight: 600;
    border-left: 3px solid var(--primary);
}

.sidebar-nav-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.main-content {
    flex-grow: 1;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden !important;
    width: 100%;
    max-width: 100%;
    height: 100%;
    box-sizing: border-box;
}

/* KPI Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
    width: 100%;
}

.kpi-card {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    min-width: 0;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    border-color: rgba(196, 30, 58, 0.4);
}

.kpi-info {
    min-width: 0;
}

.kpi-info p {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-info h2 {
    font-size: 1.7rem;
    margin-top: 6px;
    color: #FFFFFF;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--primary);
    flex-shrink: 0;
}

/* Responsive Table Wrapper - Guaranteed Zero Horizontal Scrollbar */
.table-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    display: block;
    margin-top: 15px;
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.table-wrapper::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.data-table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.82rem;
    table-layout: auto;
    box-sizing: border-box;
}

.data-table th {
    background: rgba(13, 15, 20, 0.95);
    color: var(--text-muted);
    padding: 8px 8px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border-color);
    white-space: normal;
    vertical-align: middle;
    word-break: normal;
    overflow-wrap: break-word;
    box-sizing: border-box;
}

.data-table td {
    padding: 8px 8px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.82rem;
    line-height: 1.35;
    vertical-align: middle;
    word-break: break-word;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}

.data-table td .btn,
.data-table td .btn-sm {
    padding: 3px 6px !important;
    font-size: 0.72rem !important;
    line-height: 1.2;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.data-table td .badge {
    padding: 2px 6px !important;
    font-size: 0.70rem !important;
    line-height: 1.2;
    display: inline-block;
    white-space: nowrap;
}

.data-table td small {
    display: block;
    line-height: 1.25;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* 9-Step Tracking Timeline Stepper (Responsive) */
.stepper-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin: 35px 0;
    padding: 0 10px;
    width: 100%;
}

.stepper-container::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 30px;
    right: 30px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 1;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
}

.step-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.step-item.completed .step-icon {
    background: var(--success);
    border-color: var(--success);
    color: #FFFFFF;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.step-item.active .step-icon {
    background: var(--primary);
    border-color: var(--secondary);
    color: #FFFFFF;
    box-shadow: 0 0 20px rgba(196, 30, 58, 0.6);
    transform: scale(1.1);
}

.step-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    max-width: 85px;
}

.step-item.active .step-label {
    color: var(--secondary);
    font-weight: 700;
}

/* AI Insight Box */
.ai-card {
    border-left: 4px solid var(--secondary);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.08) 0%, rgba(22, 26, 35, 0.8) 100%);
    padding: 20px;
    margin-bottom: 20px;
    border-radius: var(--radius-sm);
    width: 100%;
}

.ai-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--secondary);
    font-weight: 700;
    flex-wrap: wrap;
}

/* Responsive Dashboard Media Queries */
@media (max-width: 992px) {
    .dashboard-container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 78px);
        overflow: visible;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 8px 10px;
        flex-direction: column;
        gap: 6px;
    }

    .sidebar-header {
        border-bottom: none !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    .sidebar-nav-container {
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
        padding-bottom: 4px;
        width: 100%;
    }

    .sidebar-nav-item {
        padding: 8px 12px;
        font-size: 0.85rem;
        border-left: none !important;
        border-bottom: 2px solid transparent;
        flex-shrink: 0;
        width: auto;
        white-space: nowrap;
    }

    .sidebar-nav-item.active {
        border-bottom: 2px solid var(--primary);
    }

    .main-content {
        height: auto;
        padding: 16px 12px;
    }
}

@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .kpi-card {
        padding: 14px;
    }

    .kpi-info h2 {
        font-size: 1.3rem;
    }

    .kpi-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    /* Convert Timeline Stepper to Vertical Layout on Mobile */
    .stepper-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        margin: 25px 0;
        padding-left: 20px;
    }

    .stepper-container::before {
        top: 20px;
        bottom: 20px;
        left: 36px;
        width: 4px;
        height: auto;
        right: auto;
    }

    .step-item {
        flex-direction: row;
        gap: 16px;
        width: 100%;
    }

    .step-label {
        text-align: left;
        max-width: none;
        font-size: 0.85rem;
    }

    .data-table th, .data-table td {
        padding: 6px 4px;
        font-size: 0.72rem;
    }

    .data-table td .btn, .data-table td .btn-sm {
        padding: 2px 4px !important;
        font-size: 0.68rem !important;
    }

    .data-table td .badge {
        font-size: 0.65rem !important;
        padding: 1px 4px !important;
    }
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
    gap: 20px;
    margin-bottom: 25px;
    width: 100%;
}

.overview-grid > .glass-panel {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* High-Resolution & Zoomed-Out View Scaling */
@media (min-width: 1600px) {
    .dashboard-container {
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
