/* 
Premium Modern Dashboard Styles
Vibrant, sleek, with subtle glassmorphism 
*/

/* ==========================================================================
   LOGIN PAGE STYLES (Modern & Premium)
   ========================================================================== */
:root {
    --login-primary: #0066FF;
    --login-secondary: #00D1FF;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

.login-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f4f8;
    overflow: hidden;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

/* Animated Background Blobs */
.login-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: move 20s infinite alternate;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: var(--login-primary);
    top: -100px;
    right: -100px;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: var(--login-secondary);
    bottom: -100px;
    left: -100px;
    animation-delay: -5s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: #7000ff;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes move {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(100px, 100px) scale(1.2); }
}

/* Glassmorphism Card */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.login-card {
    width: 100%;
    max-width: 450px;
    padding: 3rem;
    border-radius: 24px;
    text-align: center;
    animation: fadeInScale 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.login-header {
    margin-bottom: 2.5rem;
}

.login-logo-wrapper {
    width: 80px;
    height: 80px;
    background: white;
    margin: 0 auto 1.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.login-logo {
    width: 60px;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.login-subtitle {
    color: #4a5568;
    font-size: 1rem;
    line-height: 1.6;
    max-width: 320px;
    margin: 0 auto;
}

/* Login Button Premium Style */
.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 1rem;
    background: #1a1a1a;
    color: white;
    text-decoration: none;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.login-btn:hover {
    background: #333;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.login-btn:active {
    transform: translateY(0);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

/* Footer Section */
.login-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.login-footer p {
    font-size: 0.85rem;
    color: #718096;
    margin-bottom: 0.75rem;
}

.login-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.login-links a {
    font-size: 0.85rem;
    color: var(--login-primary);
    text-decoration: none;
    font-weight: 500;
}

.login-links a:hover {
    text-decoration: underline;
}

.dot {
    color: #cbd5e0;
}

/* Mobile Tweaks */
@media (max-width: 480px) {
    .login-card {
        padding: 2rem 1.5rem;
        margin: 1.5rem;
        border-radius: 20px;
    }
    .login-title {
        font-size: 1.75rem;
    }
}

/* ==========================================================================
   Existing Styles Start Here
   ========================================================================== */
:root {
    --bg-main: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.85);
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    
    --success: #10b981;
    --success-bg: #d1fae5;
    
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    
    --danger: #ef4444;
    --danger-bg: #fee2e2;

    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow-x: hidden !important;
    width: 100vw;
    margin: 0;
    padding: 0;
}

/* Layout Wrapper */
#app-content {
    width: 100%;
    height: 100vh;
    display: block;
    position: relative;
}

.layout {
    display: flex;
    height: 100vh;
    margin-left: 260px; /* Account for fixed sidebar */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-main);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 100;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: fixed; /* Changed to fixed for stability with external position */
    top: 0;
    left: 0;
    bottom: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.topbar-brand {
    margin-bottom: 0 !important;
    padding-right: 12px;
    border-right: 1px solid var(--border);
    margin-right: 4px;
}

.topbar-brand h2 {
    font-size: 1.1rem !important;
}

.logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.sidebar-footer {
    padding-top: 16px;
    margin-top: auto;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-label {
    padding: 16px 16px 8px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

body.collapsed .sidebar-label {
    display: none;
}

.sidebar-ext-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.sidebar-ext-link i {
    font-size: 1.1rem;
}

body.collapsed .sidebar-ext-link {
    justify-content: center;
    padding: 12px 0;
}

body.collapsed .sidebar-ext-link span {
    display: none;
}

.sidebar-ext-link:hover {
    background: #f1f5f9;
    color: var(--primary);
}

body.collapsed .sidebar-ext-link:hover {
    transform: scale(1.1);
}

.side-profile {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

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

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 16px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--danger);
}
.status-indicator.online {
    background-color: var(--success);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed Sidebar Logic is handled via body.collapsed in the responsive section */

/* Topbar - Glass Ribbon Redesign */
.topbar {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background-color: rgba(255, 255, 255, 0.5); /* Higher Translucency */
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3); /* Glass Border */
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
}

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

.topbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 40px;
}

.search-container {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 100px;
    width: 100%;
    max-width: 420px;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.search-container:focus-within {
    max-width: 520px; /* Expansion micro-animation */
    background-color: #ffffff;
    border-color: rgba(37, 99, 235, 0.4);
    box-shadow: 0 8px 16px -4px rgba(37, 99, 235, 0.08), 0 0 0 4px rgba(37, 99, 235, 0.05);
}

.search-container input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.clear-search-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
    opacity: 0;
    visibility: hidden;
}

.clear-search-btn.active {
    opacity: 1;
    visibility: visible;
}

.clear-search-btn:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.filters-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Glass Pill Filters */
.project-filter-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.4);
    padding: 8px 18px;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.project-filter-container:hover {
    background: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 12px -2px rgba(0,0,0,0.05);
    border-color: #e2e8f0;
}

.project-filter-container.period-filter {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.6);
}

.project-filter-container.period-filter i, 
.project-filter-container.period-filter select {
    color: var(--text-primary);
}

.date-pill {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    outline: none;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.2s;
}

.date-pill:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* SLA Notifications */
.notification-wrapper {
    position: relative;
}

.notification-btn {
    position: relative;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.notification-btn:hover {
    background: #ffffff;
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #f8fafc;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

/* SLA Notification Drawer (Replacing Glassmorphism Popover) */
.notification-drawer {
    position: fixed;
    top: 0;
    right: -420px; /* Hidden by default */
    width: 420px;
    height: 100vh;
    background: #ffffff;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 1px solid #e2e8f0;
}

.notification-drawer.active {
    transform: translateX(-420px);
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.drawer-header {
    padding: 24px;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left i {
    font-size: 1.4rem;
    color: var(--primary);
}

.header-left h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.4px;
}

.drawer-actions {
    padding: 12px 24px;
    background: #f8fafc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-text-small {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.8;
}

.btn-text-small:hover {
    background: rgba(37, 99, 235, 0.08);
    opacity: 1;
}

.alerts-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.close-drawer {
    width: 36px;
    height: 36px;
    background: #f1f5f9;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.close-drawer:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #fcfdfe;
}

.notification-empty {
    padding: 64px 24px;
    text-align: center;
    color: var(--text-muted);
}

.notification-empty i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.2;
}

.notification-item {
    margin-bottom: 16px;
    padding: 20px;
    background: #ffffff;
    border-radius: 16px;
    display: flex;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border: 1px solid #eef2f6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.notification-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    border-color: rgba(37, 99, 235, 0.1);
}

.notification-item.unread {
    background: #f8fbff;
    border-color: rgba(37, 99, 235, 0.2);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    top: 16px;
    right: 16px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.notification-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.4rem;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.notification-msg {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.drawer-footer {
    padding: 20px 24px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
}

.monitoring-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@media (max-width: 480px) {
    .notification-drawer {
        width: 100%;
        right: -100%;
    }
    .notification-drawer.active {
        transform: translateX(-100%);
    }
}

/* End of Notification Drawer Styles */

/* Dashboard Body */
.dashboard-body {
    padding: 32px;
    width: 100%;
    margin: 0;
}

/* SPA View Logic */
.view-section {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}
.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.subtitle { color: var(--text-secondary); }

.btn {
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    border: none;
}
.btn-primary { background-color: var(--primary); color: white; box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39); }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
.btn-outline:hover { background: #f8fafc; }

/* Glassmorphism Classes */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: var(--shadow-glass);
    border-radius: var(--radius-lg);
}

/* KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}
.kpi-card { padding: 24px; display: flex; align-items: center; gap: 20px; transition: transform 0.2s; }
.kpi-card:hover { transform: translateY(-4px); }

.kpi-icon { width: 60px; height: 60px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 28px; }
.kpi-icon.primary { background-color: #eff6ff; color: var(--primary); }
.kpi-icon.warning { background-color: var(--warning-bg); color: var(--warning); }
.kpi-icon.success { background-color: var(--success-bg); color: var(--success); }
.kpi-icon.danger { background-color: var(--danger-bg); color: var(--danger); }
.kpi-icon.purple { background-color: #f3e8ff; color: #a855f7; } /* Team card icon */

.kpi-info p { color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; margin-bottom: 4px; }
.kpi-info h3 { font-size: 1.8rem; font-weight: 700; }

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}
.chart-container { padding: 24px; }
.chart-container h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 20px; color: var(--text-primary); }
.canvas-wrapper { position: relative; height: 300px; width: 100%; }
.large-chart-container { 
    width: 100%; 
    margin-bottom: 64px !important; 
    padding-bottom: 60px !important; 
}

/* Table */
.table-container { padding: 24px; }
.table-container.full-height { border-radius: var(--radius-xl); }
.table-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

.modern-select { padding: 8px 12px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-main); outline: none; font-weight: 500; color: var(--text-primary); }

.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table th { text-align: left; padding: 16px 20px; font-size: 0.75rem; font-weight: 700; color: #64748b; text-transform: uppercase; border-bottom: 2px solid #f1f5f9; letter-spacing: 0.6px; line-height: 1.4; }
.data-table td { padding: 16px 20px; font-size: 0.9rem; color: var(--text-primary); border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.data-table tr:hover td { background-color: #f8fafc; }

/* Sticky Column for Team Performance Table */
.table-wrapper {
    overflow-x: auto;
    max-width: 100%;
    position: relative;
}
#teamPivotTable th:first-child,
#teamPivotTable td:first-child {
    position: sticky !important;
    left: 0;
    z-index: 10;
    background-color: white !important;
    border-right: 2px solid #e2e8f0;
    box-shadow: 2px 0 5px rgba(0,0,0,0.03);
}
#teamPivotTable th:first-child {
    z-index: 11;
    background-color: #f8fafc !important;
}
/* Ensure detail rows in pivot don't break stickiness */
#teamPivotTable tr.detail-row td {
    background-color: #f9fafb;
}

/* Specific Column Widths for non-sticky */
.data-table th:nth-child(5), .data-table td:nth-child(5) { min-width: 140px; } /* System */
.data-table th:nth-child(6), .data-table td:nth-child(6) { min-width: 100px; } /* Severity */
.data-table th:nth-child(7), .data-table td:nth-child(7) { min-width: 140px; } /* Status */
.data-table th:nth-child(8), .data-table td:nth-child(8) { min-width: 160px; } /* Reporter */
.data-table th:nth-child(9), .data-table td:nth-child(9) { min-width: 160px; } /* Assignee */
.data-table th:nth-child(n+10) { min-width: 110px; text-align: center; white-space: normal; } /* SLA metrics */
.data-table td:nth-child(n+10) { text-align: center; font-weight: 600; color: #475569; }

.badge-status { 
    padding: 2px 10px; 
    border-radius: 6px; 
    font-size: 0.65rem; 
    font-weight: 700; 
    display: inline-block; 
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Status Specific Colors */
.badge-status-ack { background: rgba(59, 130, 246, 0.1); color: #2563eb; border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-status-investigate { background: rgba(139, 92, 246, 0.1); color: #7c3aed; border: 1px solid rgba(139, 92, 246, 0.2); }
.badge-status-fixing { background: rgba(245, 158, 11, 0.1); color: #d97706; border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-status-answered { background: rgba(16, 185, 129, 0.1); color: #059669; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-status-info { background: rgba(6, 182, 212, 0.1); color: #0891b2; border: 1px solid rgba(6, 182, 212, 0.2); }
.badge-status-test { background: rgba(79, 70, 229, 0.1); color: #4338ca; border: 1px solid rgba(79, 70, 229, 0.2); }
.badge-status-wait { background: rgba(100, 116, 139, 0.1); color: #475569; border: 1px solid rgba(100, 116, 139, 0.2); }
.badge-status-workaround { background: rgba(71, 85, 105, 0.1); color: #334155; border: 1px solid rgba(71, 85, 105, 0.2); }
.badge-status-fixed { background: rgba(5, 150, 105, 0.15); color: #047857; border: 1px solid rgba(5, 150, 105, 0.3); }
.badge-status-finished { background: rgba(16, 185, 129, 0.2); color: #065f46; border: 1px solid rgba(16, 185, 129, 0.4); }
.badge-status-reject { background: rgba(244, 63, 94, 0.1); color: #e11d48; border: 1px solid rgba(244, 63, 94, 0.2); }
.badge-status-open { background: rgba(148, 163, 184, 0.1); color: #64748b; border: 1px solid rgba(148, 163, 184, 0.2); }
.badge-status-default { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

/* Severity Specific Classes */
.badge-status-crit { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-status-high { background: #ffedd5; color: #c2410c; border: 1px solid #fed7aa; }
.badge-status-med { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-status-low { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }

/* Type Specific Classes */
.badge-status-bug { background: #fff1f2; color: #be123c; border: 1px solid #ffe4e6; }
.badge-status-feature { background: #e0e7ff; color: #4338ca; border: 1px solid #c7d2fe; }
.badge-status-support { background: #ecfeff; color: #0e7490; border: 1px solid #cffafe; }

/* Functional System Classes */
.badge-sys-identity { background: rgba(14, 165, 233, 0.1); color: #0369a1; border: 1px solid rgba(14, 165, 233, 0.2); }
.badge-sys-legal { background: rgba(168, 85, 247, 0.1); color: #7e22ce; border: 1px solid rgba(168, 85, 247, 0.2); }
.badge-sys-banking { background: rgba(245, 158, 11, 0.1); color: #b45309; border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-sys-platform { background: rgba(20, 184, 166, 0.1); color: #0f766e; border: 1px solid rgba(20, 184, 166, 0.2); }
.badge-sys-web { background: rgba(16, 185, 129, 0.1); color: #059669; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-sys-custom { background: rgba(236, 72, 153, 0.1); color: #be185d; border: 1px solid rgba(236, 72, 153, 0.2); }
.badge-sys-other { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }

.text-bold { font-weight: 700; }

/* Unified User Label Style */
.user-label {
    font-weight: 500;
    color: #334155;
    font-size: 0.85rem;
    white-space: nowrap;
}
.user-label.highlight {
    color: var(--primary);
    font-weight: 600;
}

.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Sticky Table Columns - Modernized Responsive Tiered System */
.data-table th.sticky-col,
.data-table td.sticky-col { 
    position: sticky; 
    z-index: 2; 
    background: #ffffff;
    border-right: 1px solid rgba(226, 232, 240, 0.4);
    box-shadow: none;
}

.data-table th.sticky-col { z-index: 3; border-bottom: 2px solid #f1f5f9; }
.data-table tr:hover td.sticky-col { background-color: #f8fafc; }

/* Sticky Tier: Mobile (< 768px) - Only ID is sticky */
@media (max-width: 767px) {
    .sticky-id { left: 0 !important; z-index: 5 !important; }
    .sticky-project, .sticky-date, .sticky-subject { 
        position: static !important; 
        min-width: auto !important; 
        max-width: none !important;
        box-shadow: none !important;
    }
}

/* Sticky Tier: Tablet (768px - 1024px) - ID and Subject are sticky */
@media (min-width: 768px) and (max-width: 1024px) {
    .sticky-id { left: 0; min-width: 60px; }
    .sticky-subject { 
        left: 60px; 
        min-width: 200px; 
        max-width: 200px; 
        box-shadow: 4px 0 10px -5px rgba(0,0,0,0.06);
    }
    .sticky-project, .sticky-date { position: static !important; }
}

/* Sticky Tier: Desktop (> 1024px) - Full Stickiness */
@media (min-width: 1025px) {
    .sticky-id { left: 0; min-width: 60px; }
    .sticky-project { left: 60px; min-width: 80px; }
    .sticky-date { left: 140px; min-width: 110px; }
    .sticky-subject { 
        left: 250px; 
        min-width: 300px; 
        max-width: 300px; 
        box-shadow: 4px 0 10px -5px rgba(0,0,0,0.08);
    }
}

.sticky-subject {
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis;
}

/* Column Toggle UI Styles */
.view-settings-dropdown {
    position: relative;
    display: inline-block;
}

.column-toggle-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    padding: 12px;
    display: none;
}

.column-toggle-menu.active {
    display: block;
    animation: slideDown 0.2s ease-out;
}

.column-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background 0.2s;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.column-option:hover { background: #f1f5f9; }
.column-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.col-hidden { display: none !important; }

/* Mobile Card View Styles */
/* Sorting Styles */
.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.sortable-header:hover {
    background-color: rgba(var(--primary-rgb), 0.05) !important;
}

.sort-icon {
    margin-left: 8px;
    font-size: 0.8rem;
    opacity: 0.3;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sortable-header:hover .sort-icon {
    opacity: 0.7;
}

.sort-active .sort-icon {
    opacity: 1;
    color: var(--primary);
}

.sort-asc .sort-icon {
    transform: rotate(0deg);
}

.sort-desc .sort-icon {
    transform: rotate(180deg);
}

.mobile-card-container {
    display: none;
    flex-direction: column;
    gap: 16px;
    padding: 16px 0;
}

@media (max-width: 767px) {
    .mobile-card-container { display: flex; }
}

.issue-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-id { font-weight: 700; color: var(--primary); font-size: 1rem; }
.card-date { font-size: 0.75rem; color: var(--text-muted); }
.card-subject { font-weight: 600; color: var(--text-primary); font-size: 0.95rem; margin-top: 4px; }

.card-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-size: 0.8rem;
    padding: 12px 0;
    border-top: 1px solid #f1f5f9;
}

.meta-item { display: flex; flex-direction: column; gap: 2px; }
.meta-label { font-weight: 700; color: var(--text-secondary); text-transform: uppercase; font-size: 0.65rem; }
.meta-value { color: var(--text-primary); }

.card-sla-badge {
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Horizontal Progress Bars */
.progress-list { display: flex; flex-direction: column; gap: 18px; width: 100%; margin-top: 20px; }
.progress-row { width: 100%; }
.progress-label-wrap { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 8px; font-size: 0.85rem; font-weight: 500; color: var(--text-primary); }
.progress-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 12px; }
.progress-count { color: var(--primary); font-weight: 700; font-size: 0.95rem; }
.progress-bar-bg { width: 100%; height: 8px; background-color: #eff6ff; border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }

/* Pagination & Summary Styling */
.table-footer { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-top: 1px solid var(--border); }
.pagination-info { font-size: 0.85rem; color: var(--text-secondary); }
.pagination-controls { display: flex; align-items: center; gap: 6px; }
.pagination-btn { 
    padding: 6px 12px; 
    border-radius: 6px; 
    border: 1px solid var(--border); 
    background: white; 
    color: var(--text-primary); 
    font-size: 0.85rem; 
    font-weight: 500; 
    cursor: pointer; 
    transition: all 0.2s; 
    min-width: 36px;
}
.pagination-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background-color: #f0f7ff; }
.pagination-btn.active { background-color: var(--primary); border-color: var(--primary); color: white; }
.pagination-btn:disabled { color: var(--text-muted); cursor: not-allowed; background-color: #f8fafc; }

/* Filter Bar for All Issues */
.filter-bar { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 12px; 
    margin-top: 16px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(226, 232, 240, 0.5);
}
.filter-group { display: flex; flex-direction: column; gap: 6px; min-width: 140px; }
.filter-group label { font-size: 0.7rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.filter-group select { width: 100%; }

/* Table Footer for Totals */
tfoot {
    background-color: #f8fafc;
    font-weight: 700;
    border-top: 2px solid var(--border);
}

tfoot td {
    padding: 16px 20px;
}

#teamPivotTable th, #teamPivotTable td {
    text-align: center;
}

#teamPivotTable th:first-child, #teamPivotTable td:first-child {
    text-align: left;
    font-weight: 600;
}

.text-primary-bold { color: var(--primary); font-weight: 700; }

/* SLA Badges */
.sla-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.sla-low {
    background-color: #ecfdf5;
    color: #059669;
}

.sla-mid {
    background-color: #fffbeb;
    color: #d97706;
}

.sla-high {
    background-color: #fef2f2;
    color: #dc2626;
}

/* Pivot ID List Styles */
.toggle-icon {
    font-size: 0.8rem;
    margin-right: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    color: var(--text-secondary);
}
.row-active .toggle-icon {
    transform: rotate(90deg);
}
.row-main {
    cursor: pointer;
}
.row-main:hover {
    background-color: #f1f5f9;
}
.detail-row {
    display: none;
    background-color: #f8fafc;
    border-top: none;
}
.detail-row.is-visible {
    display: table-row;
}
.detail-row td {
    padding: 8px 12px !important;
    border-top: none !important;
    vertical-align: top;
}

#teamPivotTable {
    width: 100%;
    min-width: 1500px; /* Ensure 16 columns have enough room to spread out */
    border-collapse: separate;
    border-spacing: 0;
}

#teamPivotTable th {
    white-space: normal; /* Allow word wrapping for long titles */
    word-break: break-word;
    min-width: 80px;
    vertical-align: bottom;
    padding: 12px 8px;
}

#teamPivotTable th:first-child {
    min-width: 180px; /* Assignee column needs more space */
}

/* Ensure the wrapper handles the wide content */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    background: white;
}

.id-link-list:empty::after {
    content: '';
}

/* External Chart Summary Bar */
.chart-summary-bar {
    min-height: 48px;
    padding: 12px 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-summary-bar.active {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.1);
}

.chart-summary-date {
    font-weight: 700;
    color: var(--primary);
    padding-right: 15px;
    border-right: 2px solid #e2e8f0;
}

.chart-summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-summary-item .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.chart-summary-totals {
    margin-left: auto;
    display: flex;
    gap: 24px;
    padding-left: 20px;
    border-left: 2px solid #e2e8f0;
}

.chart-summary-total-item {
    display: flex;
    flex-direction: column;
}

.chart-summary-total-item .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
}

.chart-summary-total-item .value {
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary);
}

.placeholder-text {
    color: #94a3b8;
    font-style: italic;
    width: 100%;
    text-align: center;
}

/* ----------------------------------------
   PRINT STYLES (PDF EXPORT)
   ---------------------------------------- */
@media print {
    /* Hide Navigation & UI Controls */
    .sidebar, 
    .topbar, 
    .btn, 
    .icon-btn, 
    .project-filter-container,
    .search-container,
    .user-menu,
    #sidebarToggle,
    .logo,
    .server-status {
        display: none !important;
    }

    /* Flatten Layout */
    .layout {
        display: block !important;
        height: auto !important;
        background-color: white !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
        height: auto !important;
        overflow: visible !important;
        background-color: white !important;
    }

    .dashboard-body {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }

    /* Ensure active view is visible */
    .view-section.active {
        display: block !important;
        width: 100% !important;
    }

    /* Table & Chart Containers */
    .glass {
        background: white !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: none !important;
        border: 1px solid #e2e8f0 !important;
        margin-bottom: 24px !important;
        padding: 20px !important;
        border-radius: 8px !important;
        color: black !important;
    }

    .table-container {
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
    }

    .table-wrapper {
        overflow: visible !important;
        width: 100% !important;
    }

    /* Handle wide tables for printing */
    .data-table, #teamPivotTable {
        width: 100% !important;
        min-width: 0 !important; /* Force fit to print width */
        table-layout: auto !important;
        border-collapse: collapse !important;
    }

    .data-table th, .data-table td, 
    #teamPivotTable th, #teamPivotTable td {
        border: 1px solid #e2e8f0 !important;
        padding: 8px 4px !important;
        font-size: 8pt !important;
        color: black !important;
        background: transparent !important;
    }

    /* ID links fix */
    .mini-id-link {
        border: none !important;
        padding: 0 !important;
        color: black !important;
        font-weight: normal !important;
        text-decoration: underline !important;
    }

    /* Header formatting */
    h1 { font-size: 18pt !important; margin-bottom: 10px !important; color: black !important; }
    h3 { font-size: 14pt !important; margin-bottom: 15px !important; color: black !important; }
    .subtitle { font-size: 10pt !important; margin-bottom: 20px !important; color: #64748b !important; }

    /* Forcing page breaks */
    .chart-container, .table-container, .kpi-grid {
        page-break-inside: avoid;
    }

    /* KPI Grid adjustments */
    .kpi-grid {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    .kpi-card {
        flex: 1 !important;
        min-width: 100px !important;
        border: 1px solid #e2e8f0 !important;
        padding: 10px !important;
    }

    /* Chart Print Optimization */
    .canvas-wrapper {
        min-height: 380px !important;
        width: 100% !important;
        display: block !important;
        overflow: visible !important;
    }

    canvas {
        display: none !important;
    }

    .print-img-snapshot {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        margin-bottom: 20px !important;
    }

    .chart-summary-bar {
        display: none !important;
    }

    .custom-chart-legend {
        margin-bottom: 20px !important;
    }

    .legend-pill {
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        color: #1e293b !important;
        font-weight: 700 !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* Preparation State (Screen) */
body.preparing-print canvas {
    display: none !important;
}
body.preparing-print .print-img-snapshot {
    display: block !important;
}
body.preparing-print .chart-summary-bar {
    display: none !important;
}

.print-img-snapshot {
    display: none;
}

/* Custom Chart Legend - Glass Pill Edition */
.custom-chart-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0;
    margin-top: 0;
    border-top: none;
}

.legend-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.legend-pill:hover {
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

.legend-pill.hidden {
    opacity: 0.45;
    background: rgba(226, 232, 240, 0.3);
    border-color: transparent;
    transform: scale(0.96);
    box-shadow: none;
}

.legend-pill .pill-mark {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

/* Specific styling for trend line pill */
.legend-pill.trend-item .pill-mark {
    width: 18px;
    height: 3px;
    border-radius: 2px;
}

.legend-pill:hover .pill-mark {
    box-shadow: 0 0 12px currentColor;
}

/* SLA Tooltip & Cell Styles */
.sla-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.sla-actual {
    font-size: 0.9rem;
    font-weight: 700;
}

.sla-target {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.text-success-bold {
    color: #059669 !important;
    font-weight: 700;
}

.text-danger-bold {
    color: #dc2626 !important;
    font-weight: 700;
}

/* Adjusted table column widths for SLA columns */
.data-table th:nth-child(n+11), .data-table td:nth-child(n+11) {
    min-width: 100px;
}

.text-danger { color: #ef4444; font-weight: 600; }
.text-success { color: #10b981; font-weight: 600; }

[data-theme="dark"] .text-danger { color: #f87171; }
[data-theme="dark"] .text-success { color: #34d399; }

/* ----------------------------------------
   RESPONSIVE DESIGN (MEDIA QUERIES)
   ---------------------------------------- */

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1050; /* Above regular content but below sidebar */
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    -webkit-tap-highlight-color: transparent;
    will-change: opacity;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Base Responsive Utilities */
.mobile-only { display: none; }

/* Desktop & Large Screen Fixes */
@media (min-width: 1025px) {
    /* Handle collapsed state via body class */
    body.collapsed .sidebar {
        width: 80px;
        padding: 24px 16px;
        overflow: hidden;
    }

    body.collapsed .sidebar .nav-item {
        justify-content: center;
        padding: 12px;
    }

    body.collapsed .sidebar .nav-item i {
        margin-right: 0;
    }

    body.collapsed .sidebar .nav-links a,
    body.collapsed .sidebar .server-status span {
        font-size: 0; /* Hide text labels */
    }

    body.collapsed .sidebar .nav-links a i {
        font-size: 1.25rem; /* Keep icons visible */
    }

    body.collapsed .sidebar .brand,
    body.collapsed .sidebar .server-status span {
        display: none;
    }

    body.collapsed .layout {
        margin-left: 80px;
    }
}

@media (max-width: 1024px) {
    .layout {
        margin-left: 0 !important;
    }
}

/* Tablet & Intermediate Screens */
@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .topbar-center {
        display: none; /* Hide search bar in center, move to side if needed */
    }
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        height: 100dvh; /* Safari Dynamic Viewport Height fix */
        width: 85vw;
        max-width: 320px;
        transform: translateX(-100%) translateZ(0);
        -webkit-transform: translateX(-100%) translateZ(0);
        box-shadow: 20px 0 80px rgba(0,0,0,0.15);
        z-index: 2000; /* Ensure it's on top of everything including header */
        opacity: 1 !important; /* Force visible on mobile drawer mode */
        pointer-events: auto !important;
        background-color: rgba(255, 255, 255, 0.8) !important;
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-right: 1px solid rgba(255, 255, 255, 0.3);
        padding: 32px 24px;
        -webkit-tap-highlight-color: transparent;
        will-change: transform;
    }

    .sidebar-close-btn {
        position: absolute;
        top: 24px;
        right: 20px;
        background: rgba(0, 0, 0, 0.05);
        border: none;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: var(--text-primary);
        font-size: 1.25rem;
        transition: all 0.2s ease;
    }

    .sidebar-close-btn:active {
        background: rgba(0, 0, 0, 0.1);
        transform: scale(0.9);
    }

    .sidebar-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 40px;
        padding-bottom: 24px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .sidebar-brand .logo {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .sidebar-brand h2 {
        font-size: 1.4rem;
        font-weight: 700;
        color: var(--text-primary);
    }

    .sidebar.active {
        transform: translateX(0) translateZ(0);
        -webkit-transform: translateX(0) translateZ(0);
    }

    .nav-links {
        gap: 8px;
    }

    .nav-item {
        padding: 16px 20px;
        font-size: 1.1rem;
    }

    /* Legacy .layout.collapsed rule removed — sidebar is now outside .layout */

    .main-content {
        width: 100%;
        padding-left: 0 !important;
    }

    .topbar {
        padding: 0 16px;
    }

    /* Mobile Sidebar Resources Fix */
    .sidebar-footer {
        margin-top: 32px;
        padding-top: 24px;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
    }

    .sidebar-label {
        display: block !important;
        opacity: 1 !important;
        padding: 16px 20px 8px !important;
        font-size: 0.85rem !important;
        color: var(--text-muted);
    }

    .sidebar-ext-link {
        padding: 16px 20px !important;
        font-size: 1.1rem !important;
        justify-content: flex-start !important;
    }

    .sidebar-ext-link span {
        display: inline !important;
        opacity: 1 !important;
    }

    .server-status {
        padding: 20px !important;
        font-size: 0.95rem !important;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile Screens */
@media (max-width: 768px) {
    .dashboard-body {
        padding: 16px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

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

    .large-chart-container {
        padding: 16px;
        margin-bottom: 32px !important;
    }

    .filters-group {
        display: none; /* Hide complex filters in topbar on mobile */
    }

    .topbar {
        padding: 0 12px;
        justify-content: space-between;
    }

    .topbar-center {
        display: none !important; /* Hide search completely on mobile for space */
    }

    .topbar-right {
        gap: 8px;
    }

    /* Keep toggle mock and avatar icons visible on mobile */
    .topbar-right .icon-btn span, 
    .topbar-right .user-menu span, 
    .topbar-right .user-menu .badge {
        display: none !important;
    }

    .topbar-right .icon-btn {
        padding: 6px 10px;
    }

    .avatar {
        width: 30px;
        height: 30px;
        font-size: 0.7rem;
    }

    .dashboard-body {
        padding: 12px;
    }

    /* Fixed SLA Reports Views Mobile Layout */
    #view-reports .charts-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    #view-reports .chart-container {
        height: auto !important;
        padding: 16px !important;
        margin-bottom: 0 !important;
    }

    #view-reports .canvas-wrapper {
        height: 300px !important; /* Slightly taller for readability */
    }

    /* Team View Layout Fix */
    #teamPivotTable {
        min-width: 800px !important; 
        table-layout: auto !important;
    }

    /* Standard responsive table behavior for tablet/large mobile */
    .table-wrapper {
        border-radius: 8px;
        overflow-x: auto !important;
        display: block; 
        -webkit-overflow-scrolling: touch;
        width: 100% !important; 
        margin-bottom: 1rem;
    }
    
    .table-wrapper table {
        min-width: 700px;
    }
}


/* Very Small Devices */
@media (max-width: 480px) {
    .topbar-brand h2 {
        display: none;
    }

    .brand h2 {
        display: none;
    }

    .topbar-left {
        gap: 8px;
    }

    .kpi-card {
        padding: 16px;
    }

    .kpi-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .kpi-info h3 {
        font-size: 1.4rem;
    }
}

/* ------------------------------------------- */
/* NOTIFICATIONS & MODALS                    */
/* ------------------------------------------- */

#toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-left: 5px solid var(--primary);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 300px;
    max-width: 450px;
    pointer-events: auto;
    animation: toast-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transition: opacity 0.3s, transform 0.3s;
}

@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.toast-error { border-left-color: #ef4444; }
.toast.toast-success { border-left-color: #10b981; }
.toast.toast-info { border-left-color: var(--primary); }

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 550px;
    padding: 2.5rem;
    border-radius: 24px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modal-pop 0.3s ease-out;
}

@keyframes modal-pop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.error-icon {
    font-size: 2.5rem;
    color: #ef4444;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.75rem;
    color: var(--text-primary);
}

.modal-body p {
    font-size: 1.1rem;
    color: #4b5563;
    line-height: 1.6;
}

.details-toggle {
    background: transparent;
    border: none;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.details-content {
    background: #f3f4f6;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #374151;
    overflow-x: auto;
    margin-top: 0.75rem;
    max-height: 200px;
    white-space: pre-wrap;
    font-family: 'Monaco', 'Consolas', monospace;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Glass variant */
.modal-content.glass-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* ------------------------------------------- */
/* USER PROFILE HEADER                       */
/* ------------------------------------------- */

.user-profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 16px;
    margin-left: 12px;
    border-left: 1px solid var(--border);
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-info-text {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.user-company {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.logout-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    background: #f8fafc;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: scale(1.05);
}

/* ==========================================================================
   MOBILE RESPONSIVITY (HARDENED Fallbacks)
   ========================================================================== */

@media (max-width: 767px) {
    /* 1. Force Inactive sections to be hidden (Visual Lockdown) */
    .view-section:not(.active) {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* 2. Overview & general table wrapper — allow scroll but stay visible */
    .table-wrapper {
        display: block;
        max-width: 100vw !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* 3. Hide ONLY the desktop issues table on mobile portrait */
    #fullIssuesTable,
    #issuesTableWrapper {
        display: none !important;
    }

    /* 4. Mobile-specific card view always on for Issues */
    #view-issues .mobile-card-container {
        display: flex !important;
        pointer-events: auto !important;
    }

    /* 5. Interaction Safety & Overlay Fix */
    .sidebar-overlay {
        z-index: 998;
    }
    .sidebar {
        z-index: 1001;
    }
    .nav-item {
        pointer-events: auto !important;
    }

    /* 6. Ensure Team Performance table is wide enough to scroll */
    #teamPivotTable, #slaMatrixTable {
        min-width: 800px !important;
        display: table !important;
        width: auto !important;
    }
}

/* ==========================================================================
   TOAST NOTIFICATIONS (SLA Alerts)
   ========================================================================== */

#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    width: 320px;
    padding: 16px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 16px;
    animation: toastSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
}

@keyframes toastSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.removing {
    transform: translateX(120%);
    opacity: 0;
}

.toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.toast-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.toast-close {
    position: absolute;
    top: 12px;
    right: 12px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* Toast Variants */
.toast-warning .toast-icon { background: #fef3c7; color: #d97706; }
.toast-danger .toast-icon { background: #fee2e2; color: #ef4444; }
.toast-error .toast-icon { background: #fee2e2; color: #ef4444; }
.toast-success .toast-icon { background: #d1fae5; color: #059669; }

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(0,0,0,0.05);
    width: 100%;
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left;
    animation: toastProgress linear forwards;
}

@keyframes toastProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

.toast-warning .toast-progress-bar { background: #f59e0b; }
.toast-danger .toast-progress-bar { background: #ef4444; }
.toast-success .toast-progress-bar { background: #10b981; }

/* Navigation Confirmation Modal */
.nav-confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.nav-confirm-modal.active {
    display: flex;
}

.nav-confirm-content {
    background: rgba(255, 255, 255, 0.95);
    width: 90%;
    max-width: 450px;
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transform: translateY(0);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-icon-wrapper {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 32px;
    box-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.3);
}

.nav-confirm-content h3 {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-confirm-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 32px;
}

.confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn-confirm {
    padding: 14px 24px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-keep {
    background: #f1f5f9;
    color: var(--text-primary);
}

.btn-keep:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.btn-clear {
    background: var(--primary);
    color: white;
}

.btn-clear:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Profile Hover Card */
.profile-card {
    position: fixed;
    width: 280px;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    border: 1px solid rgba(255,255,255,0.4);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.profile-card.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.profile-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.profile-card-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    overflow: hidden;
}
.profile-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-card-main h3 {
    font-size: 1rem;
    margin: 0;
    color: var(--text-primary);
}
.profile-card-main p {
    font-size: 0.8rem;
    margin: 2px 0 0;
    color: var(--text-secondary);
}

.profile-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.profile-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.profile-info-item i {
    font-size: 1.1rem;
    color: var(--primary);
    opacity: 0.8;
}

.profile-card-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(0,0,0,0.05);
}
.logout-btn-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: #fee2e2;
    color: #ef4444;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}
.logout-btn-mini:hover {
    background: #fecaca;
    transform: translateY(-1px);
}
