:root {
    /* Brand Colors - Premium & Trust */
    --color-primary: #0F172A; /* Deep Navy */
    --color-primary-light: #1E293B;
    --color-accent: #2563EB; /* Trust Blue */
    --color-accent-light: #EFF6FF;
    
    /* Semantic Colors */
    --color-success: #10B981;
    --color-success-light: #ECFDF5;
    --color-warning: #F59E0B;
    --color-warning-light: #FFFBEB;
    --color-danger: #EF4444;
    --color-danger-light: #FEF2F2;
    
    /* Neutrals */
    --bg-main: #F8FAFC;
    --bg-surface: #FFFFFF;
    --text-dark: #0F172A;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    
    /* Geometry */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 9999px;
    
    /* Shadows - Soft Apple Style */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-xl: 0 20px 40px -5px rgba(0, 0, 0, 0.08);
    
    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ================== AUTH (LOGIN) ================== */
body.is-logged-out .sidebar,
body.is-logged-out .main-content {
    display: none !important;
}

#view-auth {
    display: none;
    width: 100vw;
    height: 100vh;
    background: var(--bg-main);
}
body.is-logged-out #view-auth {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    padding: 2rem;
}

.auth-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 3rem 2.5rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}
.auth-header .logo {
    width: 56px;
    height: 56px;
    background: var(--color-primary);
    color: white;
    font-size: 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem auto;
}
.auth-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--text-dark); }
.auth-header p { color: var(--text-muted); font-size: 0.95rem; margin-top: 4px; }

.btn-block { width: 100%; justify-content: center; padding: 0.85rem; font-size: 1rem; }

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border-color); }
.auth-divider span { padding: 0 10px; }

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: white;
    font-weight: 600;
}
.btn-google img { width: 20px; height: 20px; }
.btn-google:hover { background: #f8f9fa; }

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.auth-footer a { color: var(--color-accent); font-weight: 600; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* ================== SIDEBAR ================== */
.sidebar {
    width: 280px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

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

.brand .logo {
    width: 40px;
    height: 40px;
    background: var(--color-primary);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

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

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.nav-item i { font-size: 1.1rem; width: 20px; }
.nav-item:hover { background: var(--bg-main); color: var(--text-dark); }
.nav-item.active { background: var(--color-primary); color: white; }

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}
.user-profile .avatar {
    width: 40px;
    height: 40px;
    background: var(--color-accent-light);
    color: var(--color-accent);
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}
.user-profile .name { font-weight: 600; font-size: 0.9rem; }
.user-profile .email { font-size: 0.8rem; color: var(--text-muted); }

/* ================== MAIN CONTENT ================== */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem 3rem;
    width: calc(100% - 280px);
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    padding: 0.75rem 1.5rem;
    width: 400px;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.search-bar:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px var(--color-accent-light);
}
.search-bar i { color: var(--text-muted); }
.search-bar input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.header-actions { display: flex; align-items: center; gap: 1rem; }

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-pill);
    border: none;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-light); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-dark); }
.btn-outline:hover { background: var(--bg-main); }
.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.btn-icon:hover { color: var(--text-dark); border-color: var(--text-muted); }
.badge-container { position: relative; }
.badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--color-danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-main);
}

/* Views */
.view { display: none; animation: fadeIn 0.3s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.page-header { margin-bottom: 2rem; }
.page-title { font-size: 2rem; font-weight: 700; letter-spacing: -1px; margin-bottom: 0.25rem; }
.page-subtitle { color: var(--text-muted); font-size: 1rem; }

/* Dashboard Grid */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.bg-blue { background: var(--color-accent-light); color: var(--color-accent); }
.bg-green { background: var(--color-success-light); color: var(--color-success); }
.bg-orange { background: var(--color-warning-light); color: var(--color-warning); }
.bg-gray { background: var(--bg-main); color: var(--text-dark); }
.stat-info h3 { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-info .value { font-size: 1.75rem; font-weight: 700; color: var(--text-dark); }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header { padding: 1.5rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.card-header h2 { font-size: 1.1rem; font-weight: 600; }
.card-body { padding: 1.5rem; }
.p-0 { padding: 0 !important; }
.link { color: var(--color-accent); text-decoration: none; font-size: 0.9rem; font-weight: 500; }

/* Alerts */
.alert-item { display: flex; align-items: center; gap: 1rem; padding: 1rem; border-radius: var(--radius-sm); margin-bottom: 0.5rem; background: var(--bg-main); }
.alert-item.warning { background: var(--color-warning-light); border: 1px solid rgba(245, 158, 11, 0.2); }
.alert-icon { font-size: 1.25rem; color: var(--color-warning); }
.alert-text { display: flex; flex-direction: column; }
.alert-text strong { font-size: 0.95rem; color: var(--text-dark); }
.alert-text span { font-size: 0.85rem; color: var(--text-muted); }

/* List Item */
.list-item { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); }
.list-item:last-child { border-bottom: none; }
.item-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.item-details { flex: 1; }
.item-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 2px; }
.item-meta { font-size: 0.8rem; color: var(--text-muted); }
.status-badge { padding: 4px 10px; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 600; }
.status-active { background: var(--color-success-light); color: var(--color-success); }

/* Filters */
.filters-bar { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.5rem; }
.filter-pill {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.filter-pill:hover { border-color: var(--text-dark); color: var(--text-dark); }
.filter-pill.active { background: var(--text-dark); color: white; border-color: var(--text-dark); }

/* Inventory Grid */
.inventory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.asset-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
}
.asset-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--text-muted); }
.asset-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; }
.asset-logo { width: 48px; height: 48px; background: var(--bg-main); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--text-dark); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.status-dot.active { background: var(--color-success); box-shadow: 0 0 0 4px var(--color-success-light); }
.status-dot.passive { background: var(--text-muted); }
.asset-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 2px; }
.asset-category { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1rem; }
.asset-email { font-size: 0.85rem; color: var(--text-dark); display: flex; align-items: center; gap: 6px; margin-bottom: 1rem; }
.asset-footer { border-top: 1px solid var(--border-color); padding-top: 1rem; display: flex; justify-content: space-between; align-items: center; }
.importance { font-size: 0.75rem; font-weight: 600; padding: 4px 8px; border-radius: 4px; }
.importance.high { background: var(--color-danger-light); color: var(--color-danger); }
.importance.low { background: var(--bg-main); color: var(--text-muted); }
.expiry { font-size: 0.8rem; color: var(--color-warning); font-weight: 500; display: flex; align-items: center; gap: 4px; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.modal-overlay.active { display: flex; opacity: 1; }
.modal-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow-xl);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}
.modal-overlay.active .modal-card { transform: translateY(0); }
.modal-header { padding: 1.5rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { font-size: 1.25rem; font-weight: 600; }
.btn-close { background: transparent; border: none; font-size: 1.25rem; color: var(--text-muted); cursor: pointer; }
.modal-body { padding: 1.5rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 1rem; }

/* Forms */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-dark); margin-bottom: 0.5rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    background: var(--bg-surface);
    box-shadow: 0 0 0 4px var(--color-accent-light);
}

/* Detail Grid */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.detail-item .label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.detail-item .value { font-size: 0.95rem; font-weight: 500; color: var(--text-dark); }
.notes-card { background: var(--bg-main); padding: 1rem; border-radius: var(--radius-md); border: 1px dashed var(--border-color); }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { width: 80px; padding: 1.5rem 1rem; align-items: center; }
    .brand-text, .nav-item span, .user-profile .info { display: none; }
    .nav-item { justify-content: center; padding: 12px; }
    .main-content { margin-left: 80px; width: calc(100% - 80px); padding: 2rem; }
    .search-bar { width: 300px; }
}

@media (max-width: 768px) {
    body { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; justify-content: space-between; padding: 1rem; border-right: none; border-bottom: 1px solid var(--border-color); }
    .brand { margin-bottom: 0; }
    .nav-links { flex-direction: row; flex: unset; }
    .main-content { margin-left: 0; width: 100%; padding: 1.5rem; }
    .stats-grid, .dashboard-grid, .form-row { grid-template-columns: 1fr; }
    .top-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .search-bar { width: 100%; }
}
