:root {
    --erp-primary: #0284C7;
    --erp-primary-dark: #0369A1;
    --erp-purple: #7C3AED;
    --erp-purple-light: #8B5CF6;
    --erp-bg-main: #F0F4F9;
    --erp-bg-sidebar: #FFFFFF;
    --erp-bg-card: #FFFFFF;
    --erp-text-main: #1E293B;
    --erp-text-muted: #64748B;
    --erp-text-light: #94A3B8;
    --erp-border: #E2E8F0;
    --erp-success: #10B981;
    --erp-warning: #F59E0B;
    --erp-danger: #EF4444;
    --erp-radius: 14px;
    --erp-shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --erp-shadow: 0 4px 10px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.03);
    --erp-shadow-hover: 0 10px 25px -5px rgba(0,0,0,0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--erp-bg-main);
    color: var(--erp-text-main);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* App Shell Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
    width: 250px;
    background: #FFFFFF;
    border-right: 1px solid var(--erp-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 1000;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--erp-border);
    transition: all 0.2s ease;
}

.brand-logo-img {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 20px;
    color: #0284C7;
    letter-spacing: -0.5px;
    overflow: hidden;
    white-space: nowrap;
}

.brand-logo-img span.logo-box {
    background: linear-gradient(135deg, #0284C7, #0EA5E9);
    color: #FFFFFF;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 14px;
    flex-shrink: 0;
}

.brand-logo-img .brand-text {
    transition: opacity 0.2s ease, max-width 0.2s ease;
    max-width: 160px;
    overflow: hidden;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--erp-text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-toggle-btn:hover {
    background: #F1F5F9;
    color: var(--erp-primary);
}

/* Sidebar Collapsed State (Desktop) */
.sidebar-collapsed .app-sidebar {
    width: 72px;
}

.sidebar-collapsed .brand-text {
    opacity: 0;
    max-width: 0 !important;
    display: none;
}

.sidebar-collapsed .sidebar-brand {
    padding: 16px 8px;
    justify-content: center;
    gap: 4px;
}

.sidebar-collapsed .sidebar-toggle-btn {
    font-size: 15px;
    padding: 2px 4px;
}

.sidebar-collapsed .nav-section-title {
    opacity: 0;
    height: 1px;
    margin: 8px 12px;
    padding: 0;
    background: var(--erp-border);
    overflow: hidden;
    text-indent: -9999px;
}

.sidebar-collapsed .nav-item-link {
    justify-content: center;
    padding: 10px 0;
    margin: 2px 8px;
}

.sidebar-collapsed .nav-item-link .flex-grow-1 {
    display: none !important;
}

/* Backdrop for Mobile Sidebar */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.25s ease;
}

@media (max-width: 991px) {
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100vh;
        z-index: 1050;
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar-mobile-open .app-sidebar {
        transform: translateX(0);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    }

    .sidebar-mobile-open .sidebar-backdrop {
        display: block;
        opacity: 1;
    }
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #94A3B8;
    padding: 12px 14px 6px;
    letter-spacing: 0.8px;
}

.nav-item-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    border-radius: 10px;
    color: #475569;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.nav-item-link:hover {
    background: #F1F5F9;
    color: #0284C7;
}

.nav-item-link.active {
    background: linear-gradient(90deg, #0284C7, #0EA5E9);
    color: #FFFFFF;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.nav-item-link.active .nav-icon-badge {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #FFFFFF !important;
}

.nav-icon-badge {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.nav-icon-badge.blue { background: #E0F2FE; color: #0284C7; }
.nav-icon-badge.orange { background: #FFEDD5; color: #EA580C; }
.nav-icon-badge.green { background: #DCFCE7; color: #16A34A; }
.nav-icon-badge.pink { background: #FCE7F3; color: #DB2777; }
.nav-icon-badge.purple { background: #F3E8FF; color: #9333EA; }
.nav-icon-badge.teal { background: #CCFBF1; color: #0D9488; }
.nav-icon-badge.gray { background: #F1F5F9; color: #475569; }

/* Main Workspace */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Topbar Header */
.app-topbar {
    height: 62px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--erp-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.quick-add-wrapper {
    position: relative;
}

.btn-add-quick {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8B5CF6, #7C3AED);
    color: #FFFFFF;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-add-quick:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.45);
    color: #FFFFFF;
}

.btn-add-quick:active {
    transform: scale(0.95);
}

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

/* Quick Add Dropdown Menu */
.quick-add-menu {
    width: 620px;
    max-width: 94vw;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.18), 0 0 1px rgba(0, 0, 0, 0.1);
    animation: quickAddFade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    margin-top: 10px !important;
    background: #FFFFFF;
}

@keyframes quickAddFade {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.quick-add-header {
    background: linear-gradient(135deg, #7C3AED 0%, #0284C7 100%);
    padding: 16px 20px;
}

.quick-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: #94A3B8;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.quick-action-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 10px;
    text-decoration: none;
    color: #1E293B;
    transition: all 0.15s ease;
    margin-bottom: 4px;
}

.quick-action-card:hover {
    background: #F1F5F9;
    transform: translateX(3px);
    color: #0284C7;
}

.quick-icon-box {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.quick-icon-box.purple { background: #F3E8FF; color: #9333EA; }
.quick-icon-box.green { background: #DCFCE7; color: #16A34A; }
.quick-icon-box.pink { background: #FCE7F3; color: #DB2777; }
.quick-icon-box.teal { background: #CCFBF1; color: #0D9488; }
.quick-icon-box.orange { background: #FFEDD5; color: #EA580C; }
.quick-icon-box.blue { background: #E0F2FE; color: #0284C7; }
.quick-icon-box.amber { background: #FEF3C7; color: #D97706; }
.quick-icon-box.gray { background: #F1F5F9; color: #475569; }

.quick-action-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}

.quick-action-title {
    font-size: 12.5px;
    font-weight: 600;
    color: #1E293B;
}

.quick-action-desc {
    font-size: 10.5px;
    color: #64748B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-search {
    width: 280px;
    position: relative;
}

.topbar-search input {
    width: 100%;
    padding: 7px 14px 7px 34px;
    border-radius: 20px;
    border: 1px solid #E2E8F0;
    background: #F8FAFC;
    font-size: 13px;
    outline: none;
}

.topbar-search i {
    position: absolute;
    left: 12px;
    top: 10px;
    color: #94A3B8;
    font-size: 13px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.icon-btn {
    position: relative;
    background: none;
    border: none;
    color: #64748B;
    font-size: 16px;
    cursor: pointer;
}

.badge-count {
    position: absolute;
    top: -4px;
    right: -6px;
    background: #EF4444;
    color: #FFFFFF;
    font-size: 9.5px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-profile-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-profile-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #0284C7;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.user-profile-info {
    line-height: 1.2;
}

.user-profile-name {
    font-weight: 700;
    font-size: 13.5px;
    color: #1E293B;
}

.user-profile-role {
    font-size: 11px;
    background: #E0F2FE;
    color: #0284C7;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Page Body */
.app-body {
    padding: 24px 28px;
    flex: 1;
}

/* Dashboard Filter Bar */
.dashboard-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 22px;
}

.date-filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #FFFFFF;
    padding: 6px 14px;
    border-radius: 12px;
    border: 1px solid var(--erp-border);
    box-shadow: var(--erp-shadow-sm);
}

.date-filter-group span.label {
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
}

.date-input-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12.5px;
    font-weight: 500;
    color: #1E293B;
}

.btn-apply-filter {
    background: linear-gradient(135deg, #7C3AED, #6D28D9);
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    padding: 5px 14px;
    font-size: 12.5px;
    font-weight: 600;
}

.btn-reset-filter {
    background: #F1F5F9;
    color: #64748B;
    border: 1px solid #CBD5E1;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.summary-chips-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.summary-chip.blue { background: #E0F2FE; color: #0284C7; border: 1px solid #BAE6FD; }
.summary-chip.green { background: #DCFCE7; color: #16A34A; border: 1px solid #BBF7D0; }
.summary-chip.amber { background: #FEF3C7; color: #D97706; border: 1px solid #FDE68A; }

.btn-download-report {
    background: linear-gradient(135deg, #7C3AED, #8B5CF6);
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 4 Main Metric Cards (Matching Screenshot) */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

@media (max-width: 1200px) {
    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .metrics-row {
        grid-template-columns: 1fr;
    }
}

.metric-stat-card {
    background: #FFFFFF;
    border-radius: var(--erp-radius);
    padding: 20px;
    border: 1px solid #E2E8F0;
    box-shadow: var(--erp-shadow);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.metric-stat-card:hover {
    box-shadow: var(--erp-shadow-hover);
    transform: translateY(-2px);
}

.metric-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.metric-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.metric-icon-box.blue { background: #0284C7; color: #FFFFFF; }
.metric-icon-box.green { background: #10B981; color: #FFFFFF; }
.metric-icon-box.amber { background: #F59E0B; color: #FFFFFF; }
.metric-icon-box.purple { background: #8B5CF6; color: #FFFFFF; }

.metric-tag {
    font-size: 11px;
    font-weight: 600;
    background: #F8FAFC;
    color: #64748B;
    border: 1px solid #E2E8F0;
    padding: 3px 8px;
    border-radius: 6px;
}

.metric-tag.outstanding {
    background: #FFFBEB;
    color: #B45309;
    border-color: #FDE68A;
}

.metric-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748B;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.metric-number {
    font-size: 24px;
    font-weight: 800;
    color: #0F172A;
    margin-bottom: 14px;
    letter-spacing: -0.5px;
}

.metric-card-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.metric-link {
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.metric-link.blue { color: #0284C7; }
.metric-link.green { color: #10B981; }
.metric-link.amber { color: #D97706; }
.metric-link.purple { color: #8B5CF6; }

/* Dashboard Widgets Grid */
.widgets-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .widgets-grid-2 {
        grid-template-columns: 1fr;
    }
}

.dashboard-widget-card {
    background: #FFFFFF;
    border-radius: var(--erp-radius);
    border: 1px solid #E2E8F0;
    box-shadow: var(--erp-shadow);
    overflow: hidden;
}

.widget-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #F1F5F9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.widget-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #1E293B;
    display: flex;
    align-items: center;
    gap: 8px;
}

.widget-card-body {
    padding: 20px;
}

/* Donut Chart Simulation */
.donut-summary-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.donut-chart-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: conic-gradient(#F59E0B 0% 85%, #0284C7 85% 95%, #10B981 95% 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.donut-chart-inner {
    width: 100px;
    height: 100px;
    background: #FFFFFF;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.donut-chart-inner small {
    font-size: 9.5px;
    font-weight: 700;
    color: #64748B;
    text-transform: uppercase;
}

.donut-chart-inner span {
    font-size: 13px;
    font-weight: 800;
    color: #0F172A;
}

.donut-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 14px;
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}

.legend-dot.blue { background: #0284C7; }
.legend-dot.green { background: #10B981; }
.legend-dot.amber { background: #F59E0B; }

/* Future Extensible Widgets Section */
.extensible-widgets-section {
    margin-top: 28px;
}

.section-header-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header-pill h5 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #0F172A;
}