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

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #6b7280;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f3f4f6;
    --white: #ffffff;
    --text: #111827;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --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);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ── LOGIN PAGE ── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}

.login-card {
    background: var(--white);
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo .logo-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4f46e5, #764ba2);
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.login-logo .logo-icon svg {
    width: 32px;
    height: 32px;
    fill: white;
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.login-logo p {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.input-wrapper {
    position: relative;
}

.input-wrapper svg {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-light);
}

.form-control {
    width: 100%;
    padding: 0.75rem 0.875rem 0.75rem 2.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* ── DASHBOARD LAYOUT ── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: #1e1b4b;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: width 0.3s;
}

.sidebar-brand {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #4f46e5, #764ba2);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand .brand-icon svg {
    width: 22px;
    height: 22px;
    fill: white;
}

.sidebar-brand h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

.sidebar-brand span {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.45);
    display: block;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.35);
    padding: 0.75rem 1.5rem 0.4rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.5rem;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: white;
}

.nav-item.active {
    background: rgba(79,70,229,0.25);
    color: white;
    border-left-color: #818cf8;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    flex-shrink: 0;
}

.user-info .name {
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
}

.user-info .role {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.45);
}

.logout-btn {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,0.45);
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: color 0.2s;
}

.logout-btn:hover { color: #ef4444; }
.logout-btn svg { width: 18px; height: 18px; }

/* Main content */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}

.topbar-left h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.topbar-left p {
    font-size: 0.8rem;
    color: var(--text-light);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    transition: all 0.2s;
    position: relative;
}

.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

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

.page-content {
    padding: 2rem;
    flex: 1;
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.blue   { background: #eff6ff; color: #2563eb; }
.stat-icon.green  { background: #f0fdf4; color: #16a34a; }
.stat-icon.yellow { background: #fffbeb; color: #d97706; }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }

.stat-info { flex: 1; }

.stat-info .value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-info .label {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
}

.stat-info .change {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.change.up   { color: var(--success); }
.change.down { color: var(--danger); }

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.25rem;
}

.card {
    background: var(--white);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

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

.card-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.card-header span {
    font-size: 0.75rem;
    color: var(--text-light);
}

.card-body { padding: 1.5rem; }

/* Table */
.table { width: 100%; border-collapse: collapse; }

.table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 0.9rem 1rem;
    font-size: 0.875rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafafa; }

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.status-badge.active    { background: #d1fae5; color: #065f46; }
.status-badge.pending   { background: #fef3c7; color: #92400e; }
.status-badge.inactive  { background: #fee2e2; color: #991b1b; }

/* Activity list */
.activity-list { list-style: none; }

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 0.35rem;
    flex-shrink: 0;
}

.activity-dot.green  { background: var(--success); }
.activity-dot.blue   { background: #3b82f6; }
.activity-dot.yellow { background: var(--warning); }
.activity-dot.red    { background: var(--danger); }

.activity-text {
    font-size: 0.83rem;
    color: var(--text);
    line-height: 1.4;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.2rem;
}
