/* =====================================================================
   IoT & IT Project Management System — Main Stylesheet
   Design: Premium Dark Sidebar ERP + Light Content Area
   Font: Inter (Google Fonts)
   ===================================================================== */

/* ─── Google Fonts ─────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Custom Properties ────────────────────────────────────────── */
:root {
    /* Brand Colors */
    --brand-primary:    #4f46e5;
    --brand-primary-dark: #3730a3;
    --brand-secondary:  #06b6d4;
    --brand-accent:     #f59e0b;

    /* Sidebar */
    --sidebar-bg:       #0f172a;
    --sidebar-bg-dark:  #020617;
    --sidebar-text:     #94a3b8;
    --sidebar-text-hover: #f1f5f9;
    --sidebar-active-bg: rgba(79, 70, 229, 0.18);
    --sidebar-active-text: #a78bfa;
    --sidebar-active-border: #4f46e5;
    --sidebar-width:    260px;
    --sidebar-collapsed: 70px;

    /* Content Area */
    --content-bg:       #f8fafc;
    --card-bg:          #ffffff;
    --card-shadow:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --card-shadow-hover:0 8px 25px rgba(0,0,0,.1), 0 4px 10px rgba(0,0,0,.06);

    /* Text */
    --text-primary:     #0f172a;
    --text-secondary:   #64748b;
    --text-muted:       #94a3b8;

    /* Status Colors */
    --color-success:    #10b981;
    --color-warning:    #f59e0b;
    --color-danger:     #ef4444;
    --color-info:       #06b6d4;

    /* Borders */
    --border-color:     #e2e8f0;
    --border-radius:    0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;

    /* Topbar */
    --topbar-height:    64px;

    /* Transitions */
    --transition:       all 0.2s ease;
    --transition-slow:  all 0.35s cubic-bezier(0.4,0,0.2,1);
}

/* ─── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--content-bg);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ─── Scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── Sidebar ───────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: var(--transition-slow);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

/* Sidebar Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 1.25rem 1rem;
    height: var(--topbar-height);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
    color: white;
    box-shadow: 0 4px 12px rgba(79,70,229,0.4);
}

.sidebar-brand-text {
    margin-left: 0.75rem;
    overflow: hidden;
}

.sidebar-brand-name {
    display: block;
    font-weight: 700;
    font-size: 0.875rem;
    color: #f1f5f9;
    letter-spacing: 0.01em;
    line-height: 1.2;
}

.sidebar-brand-tagline {
    display: block;
    font-size: 0.65rem;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 0;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }

.nav-section-title {
    padding: 0.75rem 1rem 0.25rem;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-section-title { opacity: 0; }

.nav-item { margin: 1px 8px; }

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
    font-size: 0.8125rem;
    font-weight: 500;
    gap: 0.625rem;
}

.nav-link:hover {
    background: rgba(255,255,255,0.07);
    color: var(--sidebar-text-hover);
}

.nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-left: 2px solid var(--sidebar-active-border);
}

.nav-link i, .nav-link .nav-icon {
    width: 18px;
    text-align: center;
    font-size: 0.875rem;
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-link-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar.collapsed .nav-link-text,
.sidebar.collapsed .nav-badge { display: none; }

.sidebar.collapsed .nav-link { justify-content: center; padding: 0.6rem; }
.sidebar.collapsed .nav-link i { width: auto; }

.nav-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 20px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 0.75rem 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    gap: 0.625rem;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-user:hover { background: rgba(255,255,255,0.07); }

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.12);
}

.sidebar-user-info { overflow: hidden; }
.sidebar-user-name { display: block; font-size: 0.8rem; font-weight: 600; color: #e2e8f0; line-height: 1.2; }
.sidebar-user-role { display: block; font-size: 0.65rem; color: var(--sidebar-text); }
.sidebar.collapsed .sidebar-user-info { display: none; }

/* ─── Main Content ──────────────────────────────────────────────────── */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition-slow);
}

.main-wrapper.sidebar-collapsed { margin-left: var(--sidebar-collapsed); }

/* ─── Topbar ────────────────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    z-index: 1040;
}

.topbar-toggle {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.topbar-toggle:hover { background: #f1f5f9; color: var(--text-primary); }

.topbar-search {
    flex: 1;
    max-width: 400px;
}

.topbar-search-input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.4rem 0.75rem 0.4rem 2.25rem;
    font-size: 0.8125rem;
    background: #f8fafc;
    transition: var(--transition);
    outline: none;
    font-family: inherit;
}

.topbar-search-input:focus { border-color: var(--brand-primary); background: white; box-shadow: 0 0 0 3px rgba(79,70,229,0.08); }

.topbar-search-wrapper { position: relative; }
.topbar-search-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.75rem; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }

.topbar-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: #f1f5f9;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.topbar-btn:hover { background: var(--border-color); color: var(--text-primary); }

.topbar-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-danger);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

.topbar-avatar:hover { border-color: var(--brand-primary); }

/* ─── Page Content ──────────────────────────────────────────────────── */
.page-content {
    flex: 1;
    padding: 1.5rem;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-title { font-size: 1.375rem; font-weight: 700; color: var(--text-primary); margin: 0; line-height: 1.3; }
.page-subtitle { font-size: 0.8125rem; color: var(--text-secondary); margin: 0.25rem 0 0; }

.page-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* Breadcrumb */
.breadcrumb-wrapper { margin-bottom: 0.75rem; }
.breadcrumb { font-size: 0.75rem; margin: 0; background: none; padding: 0; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }
.breadcrumb-item a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb-item a:hover { color: var(--brand-primary); }
.breadcrumb-item.active { color: var(--text-muted); }

/* ─── Cards ─────────────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.card:hover { box-shadow: var(--card-shadow-hover); }

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.card-title { font-size: 0.9375rem; font-weight: 600; margin: 0; color: var(--text-primary); }
.card-body { padding: 1.25rem; }
.card-footer { padding: 0.875rem 1.25rem; border-top: 1px solid var(--border-color); background: #f8fafc; border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg); }

/* ─── Stat Cards ────────────────────────────────────────────────────── */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--stat-color, var(--brand-primary));
    border-radius: var(--border-radius-lg) 0 0 var(--border-radius-lg);
}

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

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    margin-bottom: 0.875rem;
    background: color-mix(in srgb, var(--stat-color, var(--brand-primary)) 12%, white);
    color: var(--stat-color, var(--brand-primary));
}

.stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1; margin-bottom: 0.25rem; color: var(--text-primary); }
.stat-label { font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; }
.stat-change { font-size: 0.75rem; margin-top: 0.5rem; display: flex; align-items: center; gap: 0.25rem; }
.stat-change.up { color: var(--color-success); }
.stat-change.down { color: var(--color-danger); }

/* ─── Tables ─────────────────────────────────────────────────────────── */
.table {
    font-size: 0.8125rem;
    margin: 0;
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border-color);
}

.table th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    background: #f8fafc;
    border-bottom: 2px solid var(--border-color);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
}

.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ─── Buttons ────────────────────────────────────────────────────────── */
.btn {
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-primary { background: var(--brand-primary); border-color: var(--brand-primary); }
.btn-primary:hover { background: var(--brand-primary-dark); border-color: var(--brand-primary-dark); box-shadow: 0 4px 12px rgba(79,70,229,0.3); }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.75rem; border-radius: 6px; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.7rem; border-radius: 5px; }

.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; }

/* ─── Forms ──────────────────────────────────────────────────────────── */
.form-label { font-size: 0.8125rem; font-weight: 500; color: var(--text-primary); margin-bottom: 0.375rem; }
.form-control, .form-select {
    font-family: inherit;
    font-size: 0.8125rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    transition: var(--transition);
    color: var(--text-primary);
    background: white;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.08);
    outline: none;
}

.form-control.is-invalid { border-color: var(--color-danger); }
.invalid-feedback { font-size: 0.75rem; color: var(--color-danger); }
.form-text { font-size: 0.75rem; color: var(--text-muted); }

/* ─── Badges ─────────────────────────────────────────────────────────── */
.badge { font-size: 0.7rem; font-weight: 600; padding: 0.25rem 0.55rem; border-radius: 6px; letter-spacing: 0.02em; }

/* ─── Progress Bars ──────────────────────────────────────────────────── */
.progress { background: #f1f5f9; border-radius: 20px; overflow: hidden; }
.progress-bar { border-radius: 20px; transition: width 0.6s ease; }

/* ─── Tabs ───────────────────────────────────────────────────────────── */
.nav-tabs {
    border-bottom: 2px solid var(--border-color);
    gap: 0;
}

.nav-tabs .nav-link {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.625rem 1rem;
    border-radius: 0;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.nav-tabs .nav-link:hover { color: var(--brand-primary); background: none; }
.nav-tabs .nav-link.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); background: none; }

/* ─── Modals ─────────────────────────────────────────────────────────── */
.modal-content {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border-radius: var(--border-radius-xl) var(--border-radius-xl) 0 0;
}

.modal-title { font-size: 1rem; font-weight: 600; }

/* ─── Alerts ─────────────────────────────────────────────────────────── */
.alert { border-radius: 10px; border: none; padding: 0.875rem 1rem; font-size: 0.8125rem; }
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger  { background: #fef2f2; color: #991b1b; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-info    { background: #eff6ff; color: #1e40af; }

/* ─── Flash Notification ─────────────────────────────────────────────── */
.flash-notification {
    position: fixed;
    top: 80px;
    right: 1.5rem;
    z-index: 9999;
    min-width: 300px;
    max-width: 420px;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideInRight 0.35s ease;
    font-size: 0.875rem;
}

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

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(120%); }
}

/* ─── Dropdown ───────────────────────────────────────────────────────── */
.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    padding: 0.4rem;
    font-size: 0.8125rem;
}

.dropdown-item {
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.dropdown-item:hover { background: #f1f5f9; color: var(--brand-primary); }
.dropdown-item.text-danger:hover { background: #fef2f2; color: var(--color-danger); }
.dropdown-divider { margin: 0.3rem 0; border-color: var(--border-color); }
.dropdown-header { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); padding: 0.4rem 0.75rem; }

/* ─── Pagination ─────────────────────────────────────────────────────── */
.pagination { font-size: 0.8125rem; gap: 0.2rem; }
.page-link { border-radius: 7px; border: 1px solid var(--border-color); color: var(--text-secondary); padding: 0.35rem 0.7rem; }
.page-link:hover { background: #f1f5f9; color: var(--brand-primary); border-color: var(--border-color); }
.page-item.active .page-link { background: var(--brand-primary); border-color: var(--brand-primary); }

/* ─── Avatar ─────────────────────────────────────────────────────────── */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.avatar-sm { width: 28px; height: 28px; border-radius: 7px; }
.avatar-lg { width: 52px; height: 52px; border-radius: 12px; }
.avatar-xl { width: 72px; height: 72px; border-radius: 16px; }

.avatar-group { display: flex; }
.avatar-group .avatar { margin-left: -8px; border: 2px solid white; }
.avatar-group .avatar:first-child { margin-left: 0; }

/* ─── Timeline ───────────────────────────────────────────────────────── */
.timeline { position: relative; }
.timeline::before { content: ''; position: absolute; left: 16px; top: 0; bottom: 0; width: 2px; background: var(--border-color); }
.timeline-item { display: flex; gap: 1rem; padding-bottom: 1.5rem; position: relative; }
.timeline-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; z-index: 1; font-size: 0.75rem; border: 2px solid white; }
.timeline-content { flex: 1; padding-top: 0.25rem; }
.timeline-title { font-weight: 600; font-size: 0.875rem; margin: 0; }
.timeline-meta { font-size: 0.75rem; color: var(--text-muted); }

/* ─── Activity Log ───────────────────────────────────────────────────── */
.activity-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.activity-item:last-child { border-bottom: none; }
.activity-avatar { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.activity-content { flex: 1; }
.activity-text { font-size: 0.8125rem; line-height: 1.4; }
.activity-time { font-size: 0.7rem; color: var(--text-muted); }

/* ─── Status Dot ─────────────────────────────────────────────────────── */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.status-dot.online { background: var(--color-success); animation: pulse-green 2s infinite; }
.status-dot.offline { background: var(--text-muted); }
.status-dot.warning { background: var(--color-warning); }
.status-dot.fault   { background: var(--color-danger); }

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
    50%       { box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}

/* ─── Empty State ────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.75rem;
    color: var(--text-muted);
}

.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; }
.empty-state-text  { font-size: 0.8125rem; }

/* ─── Loading Spinner ────────────────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.spinner-brand {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Dashboard Metric Cards ─────────────────────────────────────────── */
.metric-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }

/* ─── Kanban Board ───────────────────────────────────────────────────── */
.kanban-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; align-items: start; }
.kanban-column { background: #f8fafc; border-radius: var(--border-radius-lg); padding: 1rem; border: 1px solid var(--border-color); }
.kanban-column-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; font-weight: 600; font-size: 0.875rem; }
.kanban-card { background: white; border-radius: 8px; padding: 0.875rem; border: 1px solid var(--border-color); margin-bottom: 0.6rem; cursor: pointer; transition: var(--transition); box-shadow: var(--card-shadow); }
.kanban-card:hover { transform: translateY(-1px); box-shadow: var(--card-shadow-hover); }

/* ─── IoT Device Card ────────────────────────────────────────────────── */
.device-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.125rem;
    transition: var(--transition);
    box-shadow: var(--card-shadow);
    position: relative;
}

.device-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.device-card .status-indicator { position: absolute; top: 1rem; right: 1rem; }

/* ─── Notification Dropdown ──────────────────────────────────────────── */
.notification-list { max-height: 380px; overflow-y: auto; }
.notification-item { display: flex; gap: 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: var(--transition); text-decoration: none; color: inherit; }
.notification-item:hover { background: #f8fafc; }
.notification-item.unread { background: #eff6ff; }
.notification-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0.875rem; }
.notification-text { flex: 1; }
.notification-title { font-size: 0.8125rem; font-weight: 600; line-height: 1.3; }
.notification-msg { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.4; margin-top: 0.125rem; }
.notification-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ─── Chart Container ────────────────────────────────────────────────── */
.chart-container { position: relative; height: 280px; }

/* ─── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    :root { --sidebar-width: 0px; }

    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }

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

    .main-wrapper { margin-left: 0 !important; }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1049;
        backdrop-filter: blur(2px);
        animation: fadeIn 0.2s ease;
    }

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

    .page-content { padding: 1rem; }
    .metric-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575.98px) {
    .metric-row { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; }
    .page-actions { width: 100%; }
    .kanban-board { grid-template-columns: 1fr; }
}

/* ─── Auth Pages ─────────────────────────────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    width: 100%;
    background: #0f172a;
    position: relative;
    overflow-x: hidden;
}

.auth-graphic {
    flex: 1;
    background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 40%, #0c4a6e 100%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

@media (min-width: 992px) {
    .auth-graphic {
        display: flex !important;
    }
}

.auth-graphic::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79,70,229,0.25) 0%, transparent 70%);
    top: -100px;
    left: -100px;
}

.auth-graphic::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(6,182,212,0.15) 0%, transparent 70%);
    bottom: -50px;
    right: -50px;
}

.auth-card-wrapper {
    width: 100%;
    max-width: 480px;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    min-height: 100vh;
    overflow-y: auto;
    box-shadow: -10px 0 30px rgba(0,0,0,0.15);
}

.auth-logo {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: white;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 24px rgba(79,70,229,0.3);
}

.auth-title { font-size: 1.625rem; font-weight: 800; color: var(--text-primary); margin-bottom: 0.375rem; }
.auth-subtitle { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 2rem; }

@media (max-width: 991.98px) {
    .auth-wrapper {
        align-items: center;
        justify-content: center;
        padding: 2rem 1rem;
        background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    }
    .auth-graphic {
        display: none !important;
    }
    .auth-card-wrapper {
        max-width: 420px;
        min-height: auto;
        border-radius: 16px;
        padding: 2rem 1.75rem;
        box-shadow: 0 20px 50px rgba(0,0,0,0.4);
    }
}

/* ─── Portal (Customer) ──────────────────────────────────────────────── */
.portal-sidebar {
    background: linear-gradient(180deg, #1e40af 0%, #0f172a 100%);
}

/* ─── Animations ─────────────────────────────────────────────────────── */
.fade-in { animation: fadeInUp 0.4s ease both; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.skeleton {
    background: linear-gradient(90deg, #f0f4f8 25%, #e2e8f0 50%, #f0f4f8 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.4s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ─── Print ──────────────────────────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main-wrapper { margin: 0 !important; }
    .page-content { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}
