:root {
    --bg-color: #e9f1f8;
    --sidebar-bg: #ffffff;
    --sidebar-width: 260px;
    --header-height: 70px;
    --accent-color: #2563eb;
    --text-main: #111827;
    --text-subtle: #6b7280;
    --border-color: #e5e7eb;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.1);
    --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-stack);
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    box-sizing: border-box;
    overflow-x: hidden; /* Prevents horizontal scroll on mobile */
}

/* --- SIDEBAR (Desktop) --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000 !important;
    /* Default: OPEN on desktop */
    transform: translateX(0);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Mobile: Default Closed */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 5px 0 15px rgba(0,0,0,0.1); /* Add shadow for mobile overlay */
    }
}

/* Desktop: Can be toggled closed */
@media (min-width: 769px) {
    .sidebar.closed {
        transform: translateX(-100%);
    }
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-weight: 700;
    color: var(--text-subtle);
    border-bottom: 1px solid var(--border-color);
}

.nav-links {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

/* Primary Nav Items */
.nav-item {
    display: block;
    padding: 8px 25px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    transition: background 0.1s;
    font-size: 1rem;
}

.nav-item:hover, .nav-item.active {
    background-color: #eff6ff;
    color: var(--accent-color);
}

/* Secondary Nav Items */
.nav-item-secondary {
    display: block;
    padding: 8px 24px;
    text-decoration: none;
    color: var(--text-subtle);
    font-weight: 400;
    font-size: 0.9rem;
    transition: color 0.1s;
}

.nav-item-secondary:hover {
    color: var(--text-main);
    background-color: #f9fafb;
}

.nav-divider {
    height: 1px;
    background-color: #d1d5db;
    margin: 15px 24px;
}

/* --- MAIN CONTENT AREA --- */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    padding-bottom: 80px;
    box-sizing: border-box; /* Crucial for width calculations */
}

/* Mobile: No margin */
@media (max-width: 768px) {
    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }
}

/* Desktop: Collapsed sidebar removes margin */
@media (min-width: 769px) {
    .sidebar.closed + .main-wrapper {
        margin-left: 0;
    }
}

/* --- HEADER --- */
.app-header {
    height: var(--header-height);
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 40;
}

/* Responsive Header Text */
.header-brand {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--accent-color);
}
.header-breadcrumb {
    font-size: 1.1rem;
    color: var(--text-subtle);
    font-weight: 400;
    margin: 0 6px;
}
.header-page-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}
@media (min-width: 769px) {
    /* Larger text on desktop */
    .header-brand, .header-breadcrumb, .header-page-title {
        font-size: 1.25rem;
    }
}

.menu-toggle {
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    margin-right: 10px;
    color: var(--text-subtle);
}
.menu-toggle:hover { background: #f3f4f6; color: var(--text-main); }

/* Notification Badge Dot */
.nav-badge-dot {
    position: absolute;
    top: 0px;           /* Adjust this slightly depending on your specific icon alignment */
    right: 50%;          /* Start positioning from the center */
    margin-right: -17px; /* Move right by half icon width + spacing. (Icon is ~24px) */
    width: 10px;
    height: 10px;
    background-color: #f97316; /* Orange color */
    border-radius: 50%;
    border: 2px solid white;   /* White border makes it stand out against background */
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    z-index: 20;
    pointer-events: none;      /* Ensures clicks pass through to the button */
}

/* --- DEV SWITCHER --- */
.dev-switcher {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 140px; /* Prevent it from crushing header on mobile */
}
.dev-switcher span {
    display: none; /* Hide label on mobile to save space */
}
@media (min-width: 769px) {
    .dev-switcher { padding: 4px 10px; max-width: auto; gap: 8px; }
    .dev-switcher span { display: inline; }
}

.dev-switcher select {
    background: transparent;
    border: none;
    font-weight: 600;
    color: #166534;
    cursor: pointer;
    outline: none;
    font-size: 0.8rem;
    width: 100%;
}

/* --- DASHBOARD GRID --- */
.container {
    max-width: 1000px;
    margin: 0 auto;
    /* Mobile: Use 92% width to create the narrower look you requested */
    width: 92%; 
    padding: 15px 0; /* Vertical padding only */
    box-sizing: border-box;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    width: 100%;
}

@media (min-width: 768px) {
    .container { 
        width: 100%; /* On desktop, fill the main-wrapper area */
        padding: 20px; 
    }
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
}

.dash-card {
    background: white;
    border: 1px solid var(--accent-color);
    border-radius: 12px;
    padding: 15px;
    box-shadow: var(--card-shadow);
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .dash-card { padding: 20px; }
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (min-width: 768px) { .card-title { font-size: 1.1rem; } }

.card-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.card-list-item {
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (min-width: 768px) { .card-list-item { font-size: 0.95rem; } }
.card-list-item:last-child { border-bottom: none; }

.empty-state { color: var(--text-subtle); font-style: italic; font-size: 0.9rem; }

/* --- MOBILE BOTTOM MENU --- */
.mobile-nav {
    position: fixed;
    /* Floating "Island" Look */
    bottom: 20px;
    left: 4%; /* Centers it: (100% - 92%) / 2 */
    width: 92%;

    background: var(--accent-color); /* App Blue */
    
    /* Replaced border with shadow for depth (Blue-ish shadow now) */
    border-top: none;
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.5);
    border-radius: 20px;

    display: flex;
    justify-content: space-around;
    padding: 14px 0; /* Slightly taller padding */
    z-index: 100;
    box-sizing: border-box;
}

.mobile-link {
    text-decoration: none;
    color: #ffffff; /* White unselected */
    font-size: 1.6rem; /* Bigger font */
    font-weight: 1200;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    opacity: 1.0; /* Slight transparency for unselected to make active pop */
    transition: all 0.2s ease;
}

.mobile-link.active {
    color: #ffb74d; /* Bright Orange (Material Orange 300) - readable on blue */
    opacity: 1;
    font-weight: 1200;
    transform: translateY(-1px); /* Subtle lift */
}

@media (min-width: 768px) {
    .mobile-nav { display: none; }
}