/* ===== RESET & ROOT ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
html, body {
    height: 100%;
    overflow: hidden;
    background: #f4f7fc;
}
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --text-light: #f1f5f9;
    --text-muted: #94a3b8;
    --card-bg: #ffffff;
    --shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 12px;
}

/* ===== LOGIN ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}
.login-card {
    background: white;
    padding: 48px 40px;
    border-radius: var(--radius);
    width: 400px;
    max-width: 95%;
    box-shadow: var(--shadow);
}
.login-card h1 {
    color: #0f172a;
    font-size: 28px;
    text-align: center;
}
.login-card h1 i {
    color: var(--primary);
    margin-right: 8px;
}
.subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 14px;
}
.form-group {
    margin-bottom: 18px;
}
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #334155;
    margin-bottom: 5px;
}
.form-group label i {
    margin-right: 6px;
    color: var(--primary);
    width: 18px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: 0.2s;
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
}
.btn-block {
    width: 100%;
    justify-content: center;
}
.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: #22c55e; color: white; }
.btn-success:hover { background: #16a34a; }
.btn-warning { background: #f59e0b; color: white; }
.btn-warning:hover { background: #d97706; }
.btn-secondary { background: #94a3b8; color: white; }
.btn-secondary:hover { background: #64748b; }
.error-msg {
    color: #ef4444;
    font-size: 13px;
    margin-top: 10px;
    text-align: center;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--text-light);
    padding: 20px 0;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-brand {
    font-size: 22px;
    font-weight: 700;
    padding: 0 24px 30px 24px;
    border-bottom: 1px solid #334155;
}
.sidebar-brand i {
    color: var(--primary);
    margin-right: 10px;
}
.sidebar-nav {
    list-style: none;
    padding: 20px 0;
}
.nav-item {
    padding: 12px 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: 0.15s;
    border-left: 3px solid transparent;
    color: var(--text-muted);
    white-space: nowrap;
}
.nav-item i {
    width: 20px;
    font-size: 16px;
    flex-shrink: 0;
}
.nav-item:hover,
.nav-item.active {
    background: var(--sidebar-hover);
    color: white;
    border-left-color: var(--primary);
}

/* ===== MAIN CONTENT – FIXED WIDTH ===== */
.main-content {
    margin-left: 250px;
    height: 100vh;
    width: calc(100vw - 250px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.topbar {
    background: white;
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.topbar h2 {
    font-size: 20px;
    color: #0f172a;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.content-body {
    flex: 1;
    padding: 24px 32px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
}

/* ===== MODULE CARDS ===== */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}
.module-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    transition: 0.2s;
    cursor: pointer;
    border-left: 4px solid var(--primary);
    display: flex;
    flex-direction: column;
    min-height: 140px;
}
.module-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}
.module-card .module-icon {
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 8px;
}
.module-card .module-title {
    font-weight: 600;
    font-size: 16px;
    color: #0f172a;
}
.module-card .module-stat {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin: 8px 0 4px;
}
.module-card .module-label {
    font-size: 13px;
    color: var(--text-muted);
}
.module-card .module-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}
.module-card .module-actions .btn {
    font-size: 12px;
    padding: 4px 12px;
}
/* colour variants */
.module-card.hr { border-left-color: #3b82f6; }
.module-card.payroll { border-left-color: #8b5cf6; }
.module-card.projects { border-left-color: #f59e0b; }
.module-card.inventory { border-left-color: #10b981; }
.module-card.procurement { border-left-color: #ec4899; }
.module-card.finance { border-left-color: #14b8a6; }
.module-card.dms { border-left-color: #f97316; }
.module-card.fleet { border-left-color: #6366f1; }

/* ===== STAT CARDS (legacy) ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
}
.stat-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon {
    font-size: 28px;
    color: var(--primary);
    background: #e0e7ff;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}
.stat-card h4 {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}
.stat-card p {
    margin: 4px 0 0;
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
}

/* ===== TABLES ===== */
.table-container {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    overflow-x: auto;
    width: 100%;
}
.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}
th {
    text-align: left;
    padding: 12px 10px;
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 2px solid #e2e8f0;
}
td {
    padding: 12px 10px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}
td .actions {
    display: flex;
    gap: 8px;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.modal {
    background: white;
    border-radius: var(--radius);
    width: 600px;
    max-width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-close {
    font-size: 28px;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1;
}
.modal-body {
    padding: 24px;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: #0f172a;
    color: white;
    padding: 14px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
    min-width: 250px;
    max-width: 400px;
}
.toast.success { border-left: 5px solid #22c55e; }
.toast.error { border-left: 5px solid #ef4444; }
.toast.info { border-left: 5px solid var(--primary); }
@keyframes slideIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    .sidebar-brand span,
    .nav-item span {
        display: none;
    }
    .main-content {
        margin-left: 70px;
        width: calc(100vw - 70px);
    }
    .content-body {
        padding: 16px;
    }
    .modal {
        width: 95%;
    }
    .module-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .topbar {
        padding: 12px 16px;
    }
    .topbar h2 {
        font-size: 16px;
    }
}