/* Fonts loaded via HTML link tags for faster rendering */

/* Root CSS Variables - Light Theme (Clean Teal Professional) */
:root {
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-sidebar: #ffffff;

    /* Clear dark text for light mode */
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-light: #64748b;

    /* Primary Teal/Green Palette (KSS Clinic inspired) */
    --color-pink: #0d9488;         /* Teal primary */
    --color-pink-light: #14b8a6;   /* Light teal */
    --color-pink-hover: #0f766e;   /* Dark teal hover */
    --color-gold: #0284c7;         /* Sky blue accent */
    --color-gold-light: #0ea5e9;   /* Light sky blue */
    --color-gold-hover: #0369a1;
    --color-gold-glowing: rgba(13, 148, 136, 0.15);

    /* Stat badges */
    --status-completed: #10b981;
    --status-completed-bg: rgba(16, 185, 129, 0.12);
    --status-pending: #f59e0b;
    --status-pending-bg: rgba(245, 158, 11, 0.12);
    --status-not-assigned: #ef4444;
    --status-not-assigned-bg: rgba(239, 68, 68, 0.12);

    --border-color: rgba(13, 148, 136, 0.15);
    --border-glow: 0 0 12px rgba(13, 148, 136, 0.1);
    --box-shadow: 0 4px 24px -4px rgba(15, 23, 42, 0.08), 0 2px 8px -2px rgba(15, 23, 42, 0.06);
    --glass-blur: blur(8px);

    --transition-speed: 0.12s;
}

/* Dark Mode Variables Override (Teal Light Green) */
body.dark-mode {
    --bg-primary: #0a3d2e;        /* Medium forest teal */
    --bg-secondary: #0d5740;      /* Rich teal green */
    --bg-sidebar: #083328;        /* Slightly darker teal sidebar */
    --bg-card: rgba(13, 87, 64, 0.85);

    --text-primary: #f0fdf4;      /* Crisp near-white with green tint */
    --text-secondary: #bbf7d0;    /* Light mint green */
    --text-light: #6ee7b7;        /* Medium emerald */

    --color-pink: #34d399;         /* Bright emerald green */
    --color-pink-light: #6ee7b7;
    --color-pink-hover: #10b981;
    --color-gold: #fbbf24;         /* Warm amber — high contrast on teal */
    --color-gold-light: #fcd34d;
    --color-gold-hover: #f59e0b;
    --color-gold-glowing: rgba(52, 211, 153, 0.25);

    --border-color: rgba(52, 211, 153, 0.2);
    --border-glow: 0 0 16px rgba(52, 211, 153, 0.15);
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

body.dark-mode .sidebar-logo,
body.dark-mode .page-title,
body.dark-mode .brand-title {
    color: #f0fdf4;
    -webkit-text-fill-color: #f0fdf4;
}

/* Universal Resets & Layout */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Glass Card Component */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    box-shadow: var(--box-shadow);
    border-radius: 16px;
    padding: 2rem;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed), border-color var(--transition-speed);
}
.glass-card:hover {
    box-shadow: 0 10px 40px 0 rgba(13, 148, 136, 0.12), var(--border-glow);
    border-color: var(--color-pink);
}

/* Background Glowing Elements */
.glow-orb-1, .glow-orb-2 {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.35;
    will-change: transform;
    transform: translateZ(0);
}
.glow-orb-1 {
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--color-pink-light) 0%, rgba(0,0,0,0) 70%);
}
.glow-orb-2 {
    bottom: -100px;
    left: -100px;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--color-gold) 0%, rgba(0,0,0,0) 70%);
}



/* BUTTONS */
.btn-primary {
    background: linear-gradient(135deg, var(--color-pink) 0%, var(--color-pink-light) 100%);
    border: 1px solid var(--color-pink-hover);
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(128, 0, 32, 0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-pink-hover) 0%, var(--color-pink) 100%);
    box-shadow: 0 6px 20px rgba(128, 0, 32, 0.4), var(--border-glow);
    transform: translateY(-2px);
}
.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    border: 1.5px solid var(--color-gold);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
}
.btn-secondary:hover {
    background: rgba(212, 175, 55, 0.1);
    color: var(--color-gold);
}

/* Filter Tabs Component */
.filter-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.filter-tab {
    padding: 0.5rem 1.25rem;
    border-radius: 30px;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-speed);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.filter-tab:hover, .filter-tab.active {
    background: var(--color-pink);
    color: #ffffff;
    border-color: var(--color-pink);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
}

/* --- LOGIN PAGE STYLING --- */
.login-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}
.login-card {
    width: 100%;
    max-width: 450px;
    text-align: center;
}
.brand-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    -webkit-text-fill-color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.brand-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 1.25rem;
}
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.form-control {
    width: 100%;
    padding: 0.85rem 1.2rem;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    color: var(--text-primary);
    outline: none;
    font-size: 1rem;
    font-family: 'Inter', 'Outfit', sans-serif;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}
.form-control:focus {
    border-color: var(--color-pink);
    box-shadow: 0 0 0 3px var(--color-gold-glowing);
}
.login-btn {
    width: 100%;
    justify-content: center;
    margin-top: 1.5rem;
}
.error-msg {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    width: 100%;
}

.app-container.collapsed-sidebar .sidebar {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    border-right: none !important;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    min-width: 280px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border-right: 1.5px solid var(--border-color);
    padding: 1.5rem 1.5rem 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    z-index: 99;
    box-sizing: border-box;
}
.sidebar-header {
    margin-bottom: 2rem;
    text-align: center;
}
.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    -webkit-text-fill-color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.75rem;
    display: inline-block;
    width: 100%;
    text-align: center;
}
.sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all var(--transition-speed);
}
.nav-link span {
    display: inline-block;
    opacity: 1;
    visibility: visible;
}
.nav-link:hover, .nav-link.active {
    background: var(--color-pink);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(128, 0, 32, 0.2);
}
.nav-link svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}
.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--color-pink) 0%, var(--color-gold) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ffffff;
    font-weight: bold;
    overflow: hidden;
}
.username {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.role {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Main Dashboard Area */
.main-content {
    flex: 1;
    height: 100%;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* Top bar details */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    border-bottom: 1.5px solid var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 0.5rem;
}
.page-title {
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--text-primary);
    -webkit-text-fill-color: var(--text-primary);
    border-left: none;
    padding-left: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    display: inline-block;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.08);
    border: 1.5px solid rgba(239, 68, 68, 0.25);
    color: #ef4444;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}
.btn-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    transform: translateY(-1px);
}

/* Counters & Statistics Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}
.stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
}
.stat-info h3 {
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}
.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
}
.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: rgba(13, 148, 136, 0.1);
    color: var(--color-pink);
    display: flex;
    justify-content: center;
    align-items: center;
}
.stat-card.gold-card .stat-icon {
    background: rgba(2, 132, 199, 0.12);
    color: var(--color-gold);
}

/* Complex Billing & Metrics Chart Grid */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 992px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.chart-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Custom Visual Status Ring Chart */
.donut-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 250px;
}
.donut-svg {
    transform: rotate(-90deg);
}
.donut-text {
    font-weight: 700;
    fill: var(--text-primary);
}
.donut-subtext {
    font-size: 0.5rem;
    fill: var(--text-light);
}

/* Projects & Dashboard Table styling - Fits 100% without horizontal scrollbars */
.table-responsive {
    overflow-x: hidden;
    width: 100%;
    border-radius: 12px;
}
.custom-table {
    width: 100%;
    min-width: 0 !important;
    border-collapse: collapse;
    margin-top: 0.5rem;
    text-align: left;
    table-layout: auto;
}
.custom-table th {
    background: rgba(13, 148, 136, 0.12);
    color: var(--text-primary);
    font-weight: 700;
    padding: 0.75rem 0.5rem;
    border: 1.5px solid #0d9488 !important;
    font-size: 0.88rem;
    text-align: center;
}
.custom-table td {
    padding: 0.75rem 0.5rem;
    border: 1px solid #cbd5e1 !important;
    color: var(--text-primary);
    font-size: 0.88rem;
    vertical-align: middle;
}
body.dark-mode .custom-table td {
    border: 1px solid rgba(52, 211, 153, 0.3) !important;
}
.custom-table tr:hover {
    background: rgba(13, 148, 136, 0.05);
}

/* Badges for Project Status */
.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}
.badge-completed {
    background: var(--status-completed-bg);
    color: var(--status-completed);
}
.badge-pending {
    background: var(--status-pending-bg);
    color: var(--status-pending);
}
.badge-not-assigned {
    background: var(--status-not-assigned-bg);
    color: var(--status-not-assigned);
}

/* MODAL / POPUP */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(18, 9, 16, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    width: 100%;
    max-width: 500px;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}
.modal-overlay.active .modal-content {
    transform: translateY(0);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}
.modal-close:hover {
    color: var(--color-pink);
}

/* Billing specific display */
.billing-amount {
    font-weight: 700;
    color: var(--color-gold);
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1.5px solid var(--border-color);
        padding: 1rem 1.5rem;
    }
    .sidebar-header {
        margin-bottom: 1rem;
    }
    .sidebar-footer {
        display: none;
    }
    .main-content {
        padding: 1.5rem;
    }
    .theme-toggle {
        top: 0.75rem;
        right: 0.75rem;
        width: 35px;
        height: 35px;
    }
}

/* Pagination Styling */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}
.pagination-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 38px;
    height: 38px;
    padding: 0 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition-speed);
}
.pagination-link:hover, .pagination-link.active {
    background: var(--color-pink);
    color: #ffffff;
    border-color: var(--color-pink);
    box-shadow: 0 4px 10px rgba(128, 0, 32, 0.2);
}
.pagination-link.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Close Card Button (X) */
.close-card-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 500;
    transition: all var(--transition-speed);
    z-index: 10;
}
.close-card-btn:hover {
    background: var(--color-pink);
    color: #ffffff;
    border-color: var(--color-pink);
    transform: rotate(90deg);
}

/* Micro-animations for dynamic UI loading */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Premium Timeline Modal */
.timeline-stepper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
    position: relative;
}
.timeline-stepper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--border-color);
    transform: translateY(-50%);
    z-index: 0;
    border-radius: 4px;
}
.stepper-item {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 16%;
}
.stepper-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 3px solid var(--border-color);
    transition: all 0.3s ease;
}
.stepper-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-align: center;
    transition: color 0.3s ease;
}
.stepper-item.passed .stepper-dot {
    background: var(--color-pink);
    border-color: var(--color-pink);
}
.stepper-item.passed .stepper-label {
    color: var(--color-pink);
}
.stepper-item.active .stepper-dot {
    background: var(--bg-card);
    border-color: var(--color-gold);
    box-shadow: 0 0 10px var(--color-gold-glowing);
}
.stepper-item.active .stepper-label {
    color: var(--color-gold);
}

.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 1rem;
}
.activity-item {
    display: flex;
    gap: 1.25rem;
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
}
.activity-icon-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(13, 148, 136, 0.1);
    color: var(--color-pink);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
}
.activity-line {
    width: 2px;
    flex-grow: 1;
    background: var(--border-color);
    margin-top: 0.5rem;
    min-height: 20px;
}
.activity-item:last-child .activity-line {
    display: none;
}
.activity-content {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: 12px;
    flex-grow: 1;
}
.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.activity-status {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
}
.activity-time {
    font-size: 0.8rem;
    color: var(--text-light);
}
.activity-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.activity-remarks {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(212, 175, 55, 0.05);
    border-left: 3px solid var(--color-gold);
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
}
/* Scrollbar styling for feed */
.activity-feed::-webkit-scrollbar {
    width: 6px;
}
.activity-feed::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
}
.activity-feed::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

/* ==========================================================================
   RESPONSIVE DESIGN & MOBILE SIDEBAR DRAWER TOGGLE
   ========================================================================== */

/* Dark Glass Overlay for Mobile Sidebar */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 99990;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease-out, visibility 0.12s ease-out;
}

.app-container.mobile-sidebar-open .sidebar-overlay {
    opacity: 1;
    visibility: visible;
}

/* Desktop Breakpoint (>= 992px) */
@media (min-width: 992px) {
    .sidebar {
        position: relative !important;
        transform: none !important;
        visibility: visible !important;
        opacity: 1 !important;
        top: auto !important;
        left: auto !important;
        height: auto !important;
        transition: width 0.15s ease, min-width 0.15s ease, padding 0.15s ease, margin 0.15s ease !important;
    }

    /* Collapse Sidebar on Desktop when 3-line toggle button is clicked */
    .app-container.collapsed-sidebar .sidebar {
        width: 0 !important;
        min-width: 0 !important;
        max-width: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        opacity: 0 !important;
        visibility: hidden !important;
        border-right: none !important;
    }
}

/* Mobile & Tablet Breakpoint (< 992px) */
@media (max-width: 991.98px) {
    .app-container {
        flex-direction: column;
        position: relative;
    }

    /* Hide Sidebar off-screen by default on mobile */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        width: 280px !important;
        min-width: 280px !important;
        z-index: 999999 !important;
        background: var(--bg-sidebar) !important;
        box-shadow: 5px 0 35px rgba(0, 0, 0, 0.3) !important;
        transform: translateX(-100%) !important;
        visibility: hidden !important;
        opacity: 0 !important;
        transition: transform 0.15s cubic-bezier(0, 0, 0.2, 1), opacity 0.15s ease, visibility 0.15s ease !important;
        overflow-y: auto !important;
        border-right: 1.5px solid var(--border-color);
        display: flex !important;
    }

    /* Open Mobile Sidebar Drawer when 3-dot / menu button is clicked */
    .sidebar.show,
    .app-container.mobile-sidebar-open .sidebar {
        transform: translateX(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .main-content {
        padding: 1.25rem 0.85rem !important;
        gap: 1.25rem !important;
        width: 100% !important;
    }

    .top-bar {
        position: relative !important;
        padding-bottom: 0.85rem !important;
        gap: 0.5rem !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    /* Row 1: ☰ toggle — left side */
    .top-bar > div:first-child {
        flex: 0 0 auto !important;
        order: 0 !important;
    }

    /* Hide the title from row 1 */
    .top-bar > div:first-child .page-title {
        display: none !important;
    }

    /* Row 1: Welcome + Logout section — right side */
    .top-bar > div:last-child {
        display: flex !important;
        align-items: center !important;
        gap: 0.75rem !important;
        order: 1 !important;
        flex: 0 0 auto !important;
    }

    /* WELCOME text — absolutely centered in the top-bar row */
    .top-bar > div:last-child > div:first-child {
        position: absolute !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        text-align: center !important;
    }

    /* Logout button — right corner */
    .top-bar > div:last-child > a {
        order: 2 !important;
        flex-shrink: 0 !important;
    }

    /* Row 2: Title — full width centered below */
    .top-bar::after {
        content: attr(data-mobile-title);
        display: block !important;
        width: 100% !important;
        order: 3 !important;
        text-align: center !important;
        font-size: 1rem !important;
        font-weight: 800 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        color: var(--text-primary) !important;
        font-family: 'Outfit', 'Inter', sans-serif !important;
        padding-top: 0.35rem !important;
    }

    .page-title {
        font-size: 1.15rem !important;
        line-height: 1.2 !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .stat-card {
        padding: 1rem 0.85rem !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        border-radius: 12px !important;
    }

    .stat-info h3 {
        font-size: 0.75rem !important;
        margin-bottom: 0.25rem !important;
    }

    .stat-number {
        font-size: 1.4rem !important;
    }

    .stat-icon {
        width: 38px !important;
        height: 38px !important;
        flex-shrink: 0 !important;
        border-radius: 10px !important;
    }

    .stat-icon svg {
        width: 20px !important;
        height: 20px !important;
    }

    .glass-card {
        padding: 1.25rem 1rem !important;
        border-radius: 12px !important;
    }

    .charts-grid {
        grid-template-columns: 1fr !important;
    }

    .donut-chart-container {
        flex-direction: column !important;
        gap: 1.25rem !important;
    }

    /* Filter tabs responsiveness */
    .filter-tabs {
        gap: 0.4rem !important;
    }

    .filter-tab {
        padding: 0.4rem 0.85rem !important;
        font-size: 0.82rem !important;
    }

    /* Responsive Forms */
    .form-group {
        margin-bottom: 1rem !important;
    }

    .form-control {
        font-size: 0.95rem !important;
        padding: 0.7rem 0.9rem !important;
    }

    /* Responsive Tables - Stacked Card Layout for Mobile */
    .table-responsive {
        overflow-x: hidden !important;
        width: 100% !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .custom-table {
        font-size: 0.85rem !important;
        width: 100% !important;
        min-width: auto !important;
        display: block;
    }

    .custom-table thead {
        display: none; /* Hide headers visually */
    }

    .custom-table tbody, .custom-table tr, .custom-table td {
        display: block;
        width: 100%;
    }

    .custom-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: var(--bg-card);
        padding: 0.25rem 0;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }

    .custom-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.6rem 1rem !important;
        border-bottom: 1px solid var(--border-color);
        text-align: right;
        white-space: normal !important;
    }

    .custom-table td:last-child {
        border-bottom: none;
        justify-content: flex-end;
    }

    .custom-table td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 1rem;
        text-align: left;
        color: var(--text-muted);
        text-transform: uppercase;
        font-size: 0.75rem;
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* Fix for empty "No data found" rows that use colspan */
    .custom-table td[colspan] {
        justify-content: center !important;
        text-align: center !important;
    }
    .custom-table td[colspan]::before {
        display: none !important;
    }

    /* Exception for simple tables (like dashboard) to show as standard compact tables */
    table.custom-table.compact-mobile-table {
        display: table !important;
    }
    table.custom-table.compact-mobile-table thead {
        display: table-header-group !important;
    }
    table.custom-table.compact-mobile-table tbody {
        display: table-row-group !important;
    }
    table.custom-table.compact-mobile-table tr {
        display: table-row !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }
    table.custom-table.compact-mobile-table td, 
    table.custom-table.compact-mobile-table th {
        display: table-cell !important;
        text-align: center !important;
        padding: 0.5rem 0.2rem !important;
        border-bottom: 1px solid var(--border-color) !important;
        white-space: normal !important;
    }
    table.custom-table.compact-mobile-table td:nth-child(2),
    table.custom-table.compact-mobile-table th:nth-child(2) {
        text-align: left !important;
    }
    table.custom-table.compact-mobile-table td:last-child,
    table.custom-table.compact-mobile-table th:last-child {
        text-align: right !important;
    }
    table.custom-table.compact-mobile-table td::before {
        display: none !important;
    }

    .pagination {
        flex-wrap: wrap !important;
        gap: 0.35rem !important;
        justify-content: center !important;
    }

    .pagination-link {
        padding: 0.35rem 0.7rem !important;
        font-size: 0.8rem !important;
    }
}

/* Extra Small Mobile Breakpoint (< 576px) */
@media (max-width: 575.98px) {
    .main-content {
        padding: 0.85rem 0.65rem !important;
        gap: 1rem !important;
    }

    .top-bar {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    .page-title {
        font-size: 1.15rem !important;
        line-height: 1.3 !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .stat-card {
        padding: 0.85rem 0.65rem !important;
        border-radius: 10px !important;
    }

    .stat-info h3 {
        font-size: 0.75rem !important;
    }

    .stat-number {
        font-size: 1.35rem !important;
    }

    .stat-icon {
        width: 36px !important;
        height: 36px !important;
    }

    .filter-tabs {
        gap: 0.3rem !important;
    }

    .filter-tab {
        padding: 0.35rem 0.65rem !important;
        font-size: 0.78rem !important;
    }

    #projectsSearchForm, #dashSearchForm {
        width: 100% !important;
    }

    #projSearchInput, #dashSearchInput {
        max-width: 100% !important;
        width: 100% !important;
    }

    .btn-primary, .btn-secondary {
        padding: 0.45rem 0.85rem !important;
        font-size: 0.85rem !important;
    }

    .btn-primary, .btn-secondary {
        padding: 0.45rem 0.85rem !important;
        font-size: 0.85rem !important;
    }
}

/* Desktop Collapsed Sidebar Behavior (>= 992px) */
@media (min-width: 992px) {
    .app-container.collapsed-sidebar .sidebar {
        width: 0 !important;
        min-width: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        border-right: none !important;
    }
}

/* Global Print Stylesheet Fix */
@media print {
    @page {
        size: A4 portrait;
        margin: 8mm;
    }
    html, body {
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        background: #ffffff !important;
        color: #000000 !important;
    }
    .sidebar, .top-bar, .no-print, button, .glow-orb-1, .glow-orb-2 {
        display: none !important;
    }
    .app-container, .main-content {
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        display: block !important;
        position: static !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
}
