/* ============================================================
   CMMS - Design System & Styles
   Premium Dark Theme with Glassmorphism
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Industrial SaaS Light Theme */
    --bg-primary: #f1f5f9;
    /* Light gray app background for depth */
    --bg-secondary: #e2e8f0;
    /* Slightly darker gray for inset areas */
    --bg-surface: #ffffff;
    /* Pure white for cards and surface areas */
    --bg-card: #ffffff;
    /* Solid white for cards (removed opacity) */
    --bg-card-hover: #f8fafc;
    /* Very light gray on hover */
    --bg-glass: #ffffff;
    /* Solid white, removing glassmorphism */
    --bg-input: #ffffff;
    /* White input backgrounds */

    /* Sidebar / Light Gray Mode */
    --bg-sidebar: #f8fafc;
    /* Light gray sidebar for better text visibility */
    --sidebar-text: #1e293b;
    /* Dark slate text on light gray sidebar */
    --sidebar-muted: #64748b;
    /* Slate-500 for muted text */
    --sidebar-active-bg: #eff6ff;
    /* Very light blue active bg */
    --sidebar-active-text: #1d4ed8;
    /* Corporate blue active text */

    /* Accents & Borders */
    --border-color: #cbd5e1;
    /* Crisp gray borders */
    --border-light: #e2e8f0;
    /* Lighter gray for subtle dividers */

    /* Primary Brand: Professional Blue */
    --primary: #2563eb;
    /* Sturdy corporate blue */
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary: #475569;
    /* Slate gray secondary */

    /* Status Colors */
    --accent: #0284c7;
    /* Ocean blue accent */
    --accent-light: #38bdf8;
    --success: #059669;
    /* Emerald green */
    --success-light: #10b981;
    --warning: #d97706;
    /* Amber */
    --warning-light: #f59e0b;
    --danger: #dc2626;
    /* Red */
    --danger-light: #ef4444;

    /* Typography for Daylight Visibility */
    --text-primary: #0f172a;
    /* Very dark slate, almost black */
    --text-secondary: #334155;
    /* Dark slate for secondary text */
    --text-muted: #64748b;
    /* Slate gray for muted text */

    /* Gradients (Subtle to solid for SaaS feel) */
    --gradient-primary: linear-gradient(135deg, #2563eb, #1d4ed8);
    --gradient-accent: linear-gradient(135deg, #0ea5e9, #0284c7);
    --gradient-success: linear-gradient(135deg, #059669, #047857);
    --gradient-warning: linear-gradient(135deg, #d97706, #b45309);
    --gradient-card: linear-gradient(135deg, #ffffff, #f8fafc);

    /* Elevation / Shadows (Soft, daylight-friendly) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 10px rgba(37, 99, 235, 0.15);
    /* Soft blue glow */

    /* Dimensions */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;
    --radius-sm: 6px;
    /* Slightly sharper, professional corners */
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    /* Snappier animations */
}

/* ── Reset & Base ────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-dark);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ── Login Page ──────────────────────────────────────── */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.login-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.login-bg::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    top: -200px;
    right: -100px;
    animation: float 8s ease-in-out infinite;
}

.login-bg::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    bottom: -150px;
    left: -100px;
    animation: float 10s ease-in-out infinite reverse;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-30px) scale(1.05);
    }
}

.login-card {
    position: relative;
    z-index: 1;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-success {
    background: var(--gradient-success);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.login-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    margin-top: 8px;
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--danger-light);
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.login-error.show {
    display: block;
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    75% {
        transform: translateX(8px);
    }
}

/* ── Password Toggle & Login Footer ─────────────────── */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper .form-input {
    padding-right: 44px;
    width: 100%;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}

.password-toggle:hover {
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.08);
}

.login-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    text-align: center;
}

.login-footer p {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* ── App Layout ──────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 65px;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.sidebar-brand {
    overflow: hidden;
    transition: var(--transition);
    line-height: 1.2;
}

.sidebar.collapsed .sidebar-brand {
    opacity: 0;
    width: 0;
}

.sidebar-brand h2 {
    font-size: 16px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-brand span {
    font-size: 10px;
    color: var(--text-muted);
    display: block;
    line-height: 1.3;
}

/* Company Switcher */
.company-switcher {
    margin: 12px 14px;
    padding: 10px 12px;
    background: #f8fafc;
    /* soft gray background */
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.company-switcher:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

.company-switcher-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.company-switcher-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--sidebar-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.company-switcher-name .arrow {
    font-size: 10px;
    color: var(--text-muted);
}

.sidebar.collapsed .company-switcher {
    display: none;
}

/* Company Dropdown */
.company-dropdown {
    position: absolute;
    top: 140px;
    left: 14px;
    right: 14px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    display: none;
    overflow: hidden;
}

.company-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.company-option {
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--sidebar-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.company-option:hover {
    background: #f1f5f9;
}

.company-option.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.company-option .company-logo {
    font-size: 18px;
    opacity: 0.9;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 16px 12px 8px;
    font-weight: 600;
}

.sidebar.collapsed .nav-section-label {
    display: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-muted);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
    text-decoration: none;
}

.nav-item:hover {
    background: #f8fafc;
    color: var(--primary);
}

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
    border-left: 4px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-left: -14px;
    padding-left: 24px;
}

.nav-item.active .nav-icon {
    color: var(--primary-light);
}

.nav-item .nav-badge {
    position: absolute;
    right: 14px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 1.5px solid var(--bg-sidebar);
}

.nav-item .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item .nav-icon svg {
    width: 20px;
    height: 20px;
}

.nav-item .nav-label {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: var(--transition);
}

.sidebar.collapsed .nav-label {
    opacity: 0;
    width: 0;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar.collapsed .nav-badge {
    display: none;
}



/* ── Header ──────────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    min-height: 100vh;
}

.sidebar.collapsed~.main-content {
    margin-left: var(--sidebar-collapsed);
}

.header {
    height: var(--header-height);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-title h1 {
    font-size: 20px;
    font-weight: 700;
}

.header-title .breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Sync Indicator ──────────────────────────────── */
.sync-indicator {
    display: flex;
    align-items: center;
    margin-right: 4px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 1px solid #0ea5e9;
    border-radius: 6px;
    font-size: 11px;
    color: #0369a1;
    font-weight: 600;
    position: relative;
}

.sync-indicator::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.sync-indicator span {
    margin-left: 12px;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
    50% {
        opacity: 0.5;
        transform: translateY(-50%) scale(1.2);
    }
}

#refreshBtn svg {
    transition: transform 0.5s ease-in-out;
}

#refreshBtn.syncing svg {
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.header-search {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    transition: var(--transition);
}

.header-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.header-search input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    padding: 8px;
    outline: none;
    width: 200px;
    font-family: 'Inter', sans-serif;
}

.header-search input::placeholder {
    color: var(--text-muted);
}

.header-search svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.header-icon-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.header-icon-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--primary);
}

.header-icon-btn svg {
    width: 18px;
    height: 18px;
}

/* Header Profile Dropdown */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.header-profile {
    position: relative;
    cursor: pointer;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.header-profile:hover {
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.profile-dropdown {
    position: absolute;
    top: 60px;
    right: 24px;
    width: 260px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-dropdown-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-dropdown-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.2;
}

.profile-dropdown-role {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.profile-dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.profile-dropdown-item svg {
    color: var(--text-muted);
    transition: var(--transition);
}

.profile-dropdown-item:hover svg {
    color: var(--primary);
}

.profile-dropdown-logout {
    color: var(--danger);
}

.profile-dropdown-logout:hover {
    background: rgba(239, 68, 68, 0.05);
    color: var(--danger);
}

.profile-dropdown-logout:hover svg {
    color: var(--danger);
}

.notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.read-only-badge {
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Page Content ────────────────────────────────────── */
.page-content {
    padding: 28px;
}

/* ── KPI Cards ───────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 22px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
}

.kpi-card.kpi-blue::before {
    background: var(--gradient-accent);
}

.kpi-card.kpi-purple::before {
    background: var(--gradient-primary);
}

.kpi-card.kpi-green::before {
    background: var(--gradient-success);
}

.kpi-card.kpi-orange::before {
    background: var(--gradient-warning);
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(99, 102, 241, 0.3);
}

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.kpi-blue .kpi-icon {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent);
}

.kpi-purple .kpi-icon {
    background: rgba(139, 92, 246, 0.15);
    color: var(--secondary);
}

.kpi-green .kpi-icon {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.kpi-orange .kpi-icon {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.kpi-trend {
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-trend.up {
    color: var(--success);
}

.kpi-trend.down {
    color: var(--danger);
}

.kpi-value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 4px;
}

.kpi-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ── Data Cards / Panels ─────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 22px;
}

.card-body.no-padding {
    padding: 0;
}

/* ── Grid Layouts ────────────────────────────────────── */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* ── Utility Classes ────────────────────────────────── */
.p-2 {
    padding: 8px !important;
}

.p-4 {
    padding: 16px !important;
}

.p-6 {
    padding: 24px !important;
}

.py-2 {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

.px-4 {
    padding-left: 16px !important;
    padding-right: 16px !important;
}

.mb-1 {
    margin-bottom: 4px !important;
}

.mb-2 {
    margin-bottom: 8px !important;
}

.block {
    display: block !important;
}

.rounded {
    border-radius: 8px !important;
}

.border-bottom {
    border-bottom: 1px solid var(--border-light) !important;
}

.bg-tertiary {
    background: #f8fafc !important;
}

.uppercase {
    text-transform: uppercase !important;
}

.fs-xs {
    font-size: 11px !important;
}

.fs-xs-2 {
    font-size: 10px !important;
}

.fs-lg {
    font-size: 16px !important;
}

.fs-xl {
    font-size: 20px !important;
}

.fw-800 {
    font-weight: 800 !important;
}

.flex-end {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* ── Tables ──────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 14px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Badges & Status ─────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-running,
.badge-active,
.badge-completed,
.badge-in_stock,
.badge-scheduled {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-light);
}

.badge-maintenance,
.badge-in_progress,
.badge-waiting_parts,
.badge-medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-light);
}

.badge-breakdown,
.badge-critical,
.badge-overdue,
.badge-low_stock {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-light);
}

.badge-idle,
.badge-open,
.badge-low {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.badge-high {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-running .badge-dot,
.badge-active .badge-dot,
.badge-completed .badge-dot,
.badge-scheduled .badge-dot,
.badge-in_stock .badge-dot {
    background: var(--success);
}

.badge-maintenance .badge-dot,
.badge-in_progress .badge-dot,
.badge-waiting_parts .badge-dot,
.badge-pending_approval .badge-dot,
.badge-medium .badge-dot {
    background: var(--warning);
}

.badge-breakdown .badge-dot,
.badge-critical .badge-dot,
.badge-overdue .badge-dot,
.badge-rejected .badge-dot,
.badge-low_stock .badge-dot {
    background: var(--danger);
}

.badge-idle .badge-dot,
.badge-open .badge-dot,
.badge-low .badge-dot {
    background: var(--primary);
}

.badge-high .badge-dot {
    background: #fb923c;
}

/* ── Health Bar ──────────────────────────────────────── */
.health-bar {
    width: 80px;
    height: 6px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.health-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease;
}

.health-good {
    background: var(--success);
}

.health-warn {
    background: var(--warning);
}

.health-bad {
    background: var(--danger);
}

/* ── Activity Timeline ───────────────────────────────── */
.activity-list {
    list-style: none;
}

.activity-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background: rgba(99, 102, 241, 0.03);
    padding-left: 8px;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-action {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.activity-detail {
    font-size: 12px;
    color: var(--text-secondary);
}

.activity-meta {
    text-align: right;
    flex-shrink: 0;
}

.activity-time {
    font-size: 11px;
    color: var(--text-muted);
}

.activity-user {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ── Charts ──────────────────────────────────────────── */
.chart-container {
    position: relative;
    height: 260px;
    width: 100%;
}

/* ── Machine Cards ───────────────────────────────────── */
.machine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.machine-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: var(--transition);
    cursor: pointer;
}

.machine-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(99, 102, 241, 0.3);
}

.machine-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.machine-icon {
    font-size: 28px;
    width: 46px;
    height: 46px;
    background: var(--gradient-card);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.machine-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.machine-code {
    font-size: 12px;
    color: var(--text-muted);
}

.machine-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.machine-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.machine-info-label {
    color: var(--text-muted);
}

.machine-info-value {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ── Work Order Cards ────────────────────────────────── */
.wo-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wo-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
}

.wo-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background: var(--bg-card-hover);
}

.wo-priority-indicator {
    width: 4px;
    height: 48px;
    border-radius: 2px;
    flex-shrink: 0;
}

.wo-priority-indicator.critical {
    background: var(--danger);
}

.wo-priority-indicator.high {
    background: #fb923c;
}

.wo-priority-indicator.medium {
    background: var(--warning);
}

.wo-priority-indicator.low {
    background: var(--primary);
}

.wo-info {
    flex: 1;
}

.wo-id {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.wo-title {
    font-size: 14px;
    font-weight: 600;
    margin: 2px 0;
}

.wo-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.wo-right {
    text-align: right;
}

.wo-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Checklist ───────────────────────────────────────── */
.checklist {
    list-style: none;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

.checklist-item:last-child {
    border-bottom: none;
}

.checklist-check {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: var(--transition);
}

.checklist-check.checked {
    background: var(--gradient-success);
    border-color: var(--success);
    color: white;
    font-size: 10px;
}

/* ── Inventory ───────────────────────────────────────── */
.stock-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stock-bar {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.stock-fill {
    height: 100%;
    border-radius: 2px;
}

/* ── Tabs ────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    width: fit-content;
}

.tab {
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    font-family: 'Inter', sans-serif;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

/* ── Filter Bar ──────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 8px 32px 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-select option {
    background: var(--bg-surface);
}

/* ── Empty State ─────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* ── Modal ───────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    /* Dark slate overlay */
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: var(--danger);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ── Notification Toast ──────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.warning {
    border-left: 3px solid var(--warning);
}

.toast-message {
    font-size: 13px;
    flex: 1;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Report Section ──────────────────────────────────── */
.report-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.report-kpi {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    text-align: center;
}

.report-kpi-value {
    font-size: 28px;
    font-weight: 800;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.report-kpi-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ── Bar Chart CSS ───────────────────────────────────── */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 200px;
    padding: 10px 0;
}

.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.bar {
    width: 100%;
    max-width: 48px;
    border-radius: 6px 6px 0 0;
    background: var(--gradient-primary);
    transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 4px;
    position: relative;
}

.bar:hover {
    opacity: 0.85;
}

.bar-value {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.bar-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    font-weight: 500;
}

/* ── Donut Chart CSS ─────────────────────────────────── */
.donut-chart {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    position: relative;
    margin: 0 auto;
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.donut-center-value {
    font-size: 28px;
    font-weight: 800;
}

.donut-center-label {
    font-size: 11px;
    color: var(--text-muted);
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ── Horizontal Bar Chart ────────────────────────────── */
.h-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.h-bar-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.h-bar-label {
    width: 140px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.h-bar-track {
    flex: 1;
    height: 24px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.h-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--gradient-primary);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    padding-left: 8px;
}

.h-bar-value {
    font-size: 11px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

/* ── Settings Section ────────────────────────────────── */
.settings-section {
    margin-bottom: 28px;
}

.settings-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    font-size: 14px;
}

.setting-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Toggle Switch */
.toggle {
    width: 44px;
    height: 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.toggle.active {
    background: var(--primary);
    border-color: var(--primary);
}

.toggle::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: var(--transition);
}

.toggle.active::after {
    left: 22px;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .header {
        padding: 0 16px;
    }

    .page-content {
        padding: 16px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .machine-grid {
        grid-template-columns: 1fr;
    }

    .header-search {
        display: none;
    }

    .demo-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .h-bar-label {
        width: 100px;
    }

    .mobile-menu-btn {
        display: flex !important;
    }

    .mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        margin: 16px;
        padding: 32px 24px;
    }
}

.mobile-menu-btn {
    display: none !important;
}

/* ── Animations ──────────────────────────────────────── */
.fade-in {
    animation: fadeIn 0.4s ease;
}

.slide-in {
    animation: slideUp 0.4s ease;
}

.stagger-1 {
    animation-delay: 0.05s;
}

.stagger-2 {
    animation-delay: 0.1s;
}

.stagger-3 {
    animation-delay: 0.15s;
}

.stagger-4 {
    animation-delay: 0.2s;
}

.stagger-5 {
    animation-delay: 0.25s;
}

/* ── Utility ─────────────────────────────────────────── */
.text-muted {
    color: var(--text-muted);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-primary {
    color: var(--primary-light);
}

.text-success {
    color: var(--success-light);
}

.text-danger {
    color: var(--danger-light);
}

.text-warning {
    color: var(--warning-light);
}

.fw-600 {
    font-weight: 600;
}

.fw-700 {
    font-weight: 700;
}

.fs-sm {
    font-size: 12px;
}

.mt-4 {
    margin-top: 16px;
}

.mt-6 {
    margin-top: 24px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-6 {
    margin-bottom: 24px;
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.hidden {
    display: none !important;
}

/* ── Online Users Bar ─────────────────────────────── */
.online-users-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-md);
    padding: 10px 18px;
    font-size: 13px;
}

.online-avatar-stack {
    display: flex;
    margin-left: auto;
    gap: -6px;
}

.mini-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: white;
    border: 2px solid var(--bg-primary);
    margin-left: -6px;
}

.mini-avatar:first-child {
    margin-left: 0;
}

/* ── Live Status Indicators ──────────────────────── */
.live-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.live-status.online {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.live-status.away {
    background: var(--warning);
    box-shadow: 0 0 6px var(--warning);
}

.live-status.offline {
    background: var(--text-muted);
}

.live-status-text {
    font-size: 12px;
    text-transform: capitalize;
}

.live-status-text.online {
    color: var(--success-light);
}

.live-status-text.away {
    color: var(--warning);
}

.live-status-text.offline {
    color: var(--text-muted);
}

/* ── Action Buttons ──────────────────────────────── */
.action-btns {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
    padding: 0;
}

.action-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5px;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.action-btn.view {
    color: var(--primary);
    background: #f0f7ff;
    border-color: #dbeafe;
}

.action-btn.view:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.action-btn.edit {
    color: var(--warning);
    background: #fffbeb;
    border-color: #fef3c7;
}

.action-btn.edit:hover {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}

.action-btn.delete {
    color: var(--danger);
    background: #fef2f2;
    border-color: #fee2e2;
}

.action-btn.delete:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* ── Status Select ───────────────────────────────── */
.status-select {
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 11px;
    cursor: pointer;
}

/* ── Progress Bar ────────────────────────────────── */
.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    width: 100%;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.kpi-card.kpi-blue {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.kpi-card.kpi-orange {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
}

.kpi-card.kpi-red {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.kpi-card.kpi-green {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.progress-bar.success .progress-fill {
    background: var(--success);
}

/* ── Notification Panel ──────────────────────────── */
.notif-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.notif-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.notif-panel {
    position: fixed;
    top: 0;
    right: -380px;
    width: 380px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.notif-panel.open {
    right: 0;
}

.notif-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notif-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.notif-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.notif-item {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-light);
}

.notif-item:hover {
    background: var(--bg-hover);
}

.notif-item.unread {
    background: rgba(99, 102, 241, 0.06);
    border-left: 3px solid var(--primary);
}

.notif-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.notif-content {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 3px;
}

.notif-msg {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.notif-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Role Access Matrix ──────────────────────────── */
.role-matrix {
    width: 100%;
    border-collapse: collapse;
}

.role-matrix th,
.role-matrix td {
    padding: 12px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

.role-matrix th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.role-matrix th:first-child,
.role-matrix td:first-child {
    text-align: left;
    font-weight: 500;
}

.role-matrix .check {
    color: var(--success);
    font-size: 16px;
}

.role-matrix .cross {
    color: var(--danger);
    font-size: 16px;
}

.role-matrix .read-only {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

.role-badge-header {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}

.role-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.role-current-highlight {
    background: rgba(99, 102, 241, 0.06) !important;
}

/* ── Company Filter Bar ──────────────────────────── */
.company-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.company-filter-bar select {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 12px;
}

/* ── Confirm Dialog ──────────────────────────────── */
.confirm-dialog {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.confirm-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.confirm-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.confirm-msg {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ── Detail Grid ─────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}


.detail-item.detail-full {
    grid-column: span 2;
}

.detail-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.detail-value {
    font-size: 14px;
    font-weight: 500;
}

/* ── Button Small Success ────────────────────────── */
.btn-success {
    background: var(--success) !important;
    color: white !important;
}

.btn-success:hover {
    opacity: 0.85;
}

/* ── Role Access Checkboxes ──────────────────────── */
.role-check,
.role-cross {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 800;
}

.role-check {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.role-cross {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ── Phase 2 Status Badges ────────────────────────── */
.badge-pending_approval {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-light);
}

.badge-pending_approval .badge-dot {
    background: var(--warning);
}

.badge-rejected {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-light);
}

.badge-rejected .badge-dot {
    background: var(--danger);
}

.badge-pass {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-light);
}

.badge-pass .badge-dot {
    background: var(--success);
}

.badge-fail {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-light);
}

.badge-fail .badge-dot {
    background: var(--danger);
}

/* ── Utilities ───────────────────────────────────────── */
.flex-column {
    display: flex;
    flex-direction: column;
}

.gap-1 {
    gap: 4px;
}

.gap-2 {
    gap: 8px;
}

.gap-4 {
    gap: 16px;
}

.p-4 {
    padding: 16px;
}

.fs-xs {
    font-size: 11px;
}

.fs-sm {
    font-size: 13px;
}

.fw-600 {
    font-weight: 600;
}

.avavtar-xs {
    border: 1px solid var(--border-light);
}

.btn-xs {
    padding: 4px 8px;
    font-size: 10px;
    border-radius: 4px;
}

.donut-center-value {
    font-size: 24px;
    font-weight: 700;
}

.donut-center-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ── RBAC Inline Toggle Switches ─────────────────────── */
.rbac-toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    cursor: pointer;
}

.rbac-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.rbac-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(239, 68, 68, 0.25);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.rbac-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 2px;
    bottom: 2px;
    background: var(--danger);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.rbac-toggle input:checked+.rbac-slider,
.rbac-slider.on {
    background: rgba(16, 185, 129, 0.25);
    border-color: rgba(16, 185, 129, 0.4);
}

.rbac-toggle input:checked+.rbac-slider::before,
.rbac-slider.on::before {
    background: var(--success);
    transform: translateX(16px);
}

.rbac-toggle.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.rbac-toggle.locked .rbac-slider {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
}

.rbac-toggle.locked .rbac-slider::before {
    background: var(--success);
    transform: translateX(16px);
}

/* Role Matrix Table Overrides */
.role-matrix th {
    padding: 10px 12px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-matrix td {
    padding: 8px 12px;
    vertical-align: middle;
}

/* ── Master Plan Styles ──────────────────────────────── */
.master-plan-table th,
.master-plan-table td {
    border-right: 1px solid var(--border-light);
}

.master-plan-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    transition: var(--transition);
}

.master-plan-tag:hover {
    filter: brightness(1.2);
    transform: scale(1.05);
}

.master-plan-tag.scheduled {
    background: rgba(37, 99, 235, 0.15);
    color: var(--primary-light);
    border: 1px solid rgba(37, 99, 235, 0.3);
}

.master-plan-tag.overdue {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-light);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.master-plan-tag.completed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-light);
}

.badge-rejected .badge-dot {
    background: var(--danger);
}

.badge-pass {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-light);
}

.badge-pass .badge-dot {
    background: var(--success);
}

.badge-fail {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-light);
}

.badge-fail .badge-dot {
    background: var(--danger);
}

/* ── Utilities ───────────────────────────────────────── */
.flex-column {
    display: flex;
    flex-direction: column;
}

.gap-1 {
    gap: 4px;
}

.gap-2 {
    gap: 8px;
}

.gap-4 {
    gap: 16px;
}

.p-4 {
    padding: 16px;
}

.fs-xs {
    font-size: 11px;
}

.fs-sm {
    font-size: 13px;
}

.fw-600 {
    font-weight: 600;
}

.avavtar-xs {
    border: 1px solid var(--border-light);
}

.btn-xs {
    padding: 4px 8px;
    font-size: 10px;
    border-radius: 4px;
}

.donut-center-value {
    font-size: 24px;
    font-weight: 700;
}

.donut-center-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ── RBAC Inline Toggle Switches ─────────────────────── */
.rbac-toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    cursor: pointer;
}

.rbac-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.rbac-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(239, 68, 68, 0.25);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.rbac-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 2px;
    bottom: 2px;
    background: var(--danger);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.rbac-toggle input:checked+.rbac-slider,
.rbac-slider.on {
    background: rgba(16, 185, 129, 0.25);
    border-color: rgba(16, 185, 129, 0.4);
}

.rbac-toggle input:checked+.rbac-slider::before,
.rbac-slider.on::before {
    background: var(--success);
    transform: translateX(16px);
}

.rbac-toggle.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.rbac-toggle.locked .rbac-slider {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
}

.rbac-toggle.locked .rbac-slider::before {
    background: var(--success);
    transform: translateX(16px);
}

/* Role Matrix Table Overrides */
.role-matrix th {
    padding: 10px 12px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-matrix td {
    padding: 8px 12px;
    vertical-align: middle;
}

/* ── Master Plan Styles ──────────────────────────────── */
.master-plan-table th,
.master-plan-table td {
    border-right: 1px solid var(--border-light);
}

.master-plan-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    transition: var(--transition);
}

.master-plan-tag:hover {
    filter: brightness(1.2);
    transform: scale(1.05);
}

.master-plan-tag.scheduled {
    background: rgba(37, 99, 235, 0.15);
    color: var(--primary-light);
    border: 1px solid rgba(37, 99, 235, 0.3);
}

.master-plan-tag.overdue {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-light);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.master-plan-tag.completed {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-light);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* -- Print Styles (PDF Export) ----------------------- */
@media print {
    body {
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    #sidebar,
    .header,
    .nav-item,
    .btn-secondary,
    .filter-select,
    .btn-primary,
    #syncIndicator,
    .online-users-bar,
    .dropdown-container,
    .notification-dropdown,
    .action-btns {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .page-content {
        padding: 0 !important;
    }

    .card,
    .kpi-card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        break-inside: avoid;
        margin-bottom: 20px !important;
    }

    .data-table th {
        background: #f1f5f9 !important;
        color: black !important;
        -webkit-print-color-adjust: exact;
    }

    .badge {
        border: 1px solid #ccc !important;
        -webkit-print-color-adjust: exact;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }

    div[style*='grid-template-columns: 1fr 2fr'] {
        display: block !important;
    }

    div[style*='grid-template-columns: 1fr 2fr']>div {
        width: 100% !important;
        margin-bottom: 20px;
    }
}