
:root {
    --primary: #635bff;
    --primary-dark: #5145e5;
    --background: #f5f6fb;
    --white: #ffffff;
    --text: #20243a;
    --muted: #8990a5;
    --border: #eaecf3;
    --sidebar: #171b35;
    --shadow: 0 5px 25px rgba(30, 35, 80, .05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--background);
    color: var(--text);
}

button, input, select, textarea {
    font: inherit;
}

button {
    cursor: pointer;
    border: none;
}

.app {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 255px;
    background: var(--sidebar);
    color: white;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    padding: 28px 18px;
    z-index: 100;
    transition: .3s;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px;
    margin-bottom: 55px;
}

.brand-icon {
    width: 43px;
    height: 43px;
    border-radius: 13px;
    background: linear-gradient(135deg, #8078ff, #5145e5);
    display: grid;
    place-items: center;
    font-size: 21px;
}

.brand h2 {
    font-size: 19px;
    font-weight: 800;
}

.brand span {
    font-size: 11px;
    color: #a8aac3;
}

.menu-label {
    font-size: 10px;
    letter-spacing: 1.4px;
    color: #858aa9;
    padding: 0 12px;
    margin-bottom: 15px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    display: flex;
    gap: 13px;
    align-items: center;
    padding: 14px 15px;
    color: #aeb2c8;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 9px;
    transition: .2s;
}

.nav-link i {
    width: 20px;
    font-size: 16px;
}

.nav-link:hover, .nav-link.active {
    background: rgba(112, 101, 255, .19);
    color: white;
}

.nav-link.active {
    border-left: 3px solid #8178ff;
}

.sidebar-bottom {
    margin-top: auto;
}

.profile {
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid #30344e;
    padding: 22px 5px 0;
}

.profile strong {
    display: block;
    font-size: 12px;
}

.profile small {
    color: #999eb9;
    font-size: 11px;
}

/* MAIN */
.main {
    margin-left: 255px;
    width: calc(100% - 255px);
}

.topbar {
    height: 85px;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 35px;
    border-bottom: 1px solid var(--border);
}

.top-left, .top-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar h2 {
    font-size: 18px;
}

.topbar p {
    color: var(--muted);
    font-size: 11px;
    margin-top: 5px;
}

.status {
    color: #219a65;
    font-size: 11px;
    background: #e8f8f0;
    padding: 9px 13px;
    border-radius: 30px;
}

.status i {
    font-size: 7px;
    margin-right: 5px;
}

.avatar {
    background: #e9e7ff;
    color: #635bff;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 12px;
}

.content {
    padding: 32px 35px;
    max-width: 1600px;
    margin: auto;
}

.welcome {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 28px;
}

.welcome h1 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 8px;
}

.welcome p {
    font-size: 12px;
    color: var(--muted);
}

/* BUTTONS */
.btn-primary {
    background: var(--primary);
    color: white;
    padding: 12px 17px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    transition: .2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-light {
    background: #f2f2fa;
    color: #62667c;
    padding: 11px 14px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
}

.btn-light:hover {
    background: #e8e7f7;
}

.menu-toggle {
    display: none;
    background: transparent;
    font-size: 20px;
    color: var(--text);
}

/* STATISTICS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: white;
    border-radius: 13px;
    padding: 23px 19px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    font-size: 19px;
}

.purple { background: #efedff; color: #695fff; }
.blue { background: #e8f2ff; color: #3586e8; }
.pink { background: #fff0f5; color: #e95d91; }
.green { background: #e8f8f0; color: #23a16a; }

.stat-card span {
    font-size: 10px;
    color: var(--muted);
}

.stat-card h2 {
    font-size: 25px;
    margin-top: 6px;
}

/* PANEL */
.panel {
    background: white;
    border-radius: 13px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.panel-heading h3 {
    font-size: 15px;
    margin-bottom: 7px;
}

.panel-heading p {
    color: var(--muted);
    font-size: 11px;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 650px;
    text-align: left;
}

th {
    background: #f8f8fc;
    color: #9297aa;
    font-size: 10px;
    font-weight: 600;
    padding: 15px 12px;
    text-transform: uppercase;
    white-space: nowrap;
}

td {
    border-bottom: 1px solid #f0f0f5;
    padding: 15px 12px;
    font-size: 11px;
    white-space: nowrap;
}

tbody tr:hover {
    background: #fafaff;
}

.empty-row {
    text-align: center;
    color: var(--muted);
    padding: 35px;
}

.matricule {
    color: var(--primary);
    font-weight: 700;
}

.badge-sex {
    background: #f0efff;
    color: #675bdf;
    padding: 6px 9px;
    border-radius: 20px;
    font-size: 10px;
}

.actions {
    display: flex;
    gap: 7px;
}

.action-btn {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: #f3f2ff;
    color: #675bdf;
}

.action-btn.delete {
    background: #fff0f0;
    color: #e05252;
}

.action-btn:hover {
    opacity: .7;
}

.toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.search-box {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    padding: 0 13px;
    border-radius: 8px;
}

.search-box i {
    color: #a0a4b5;
}

.search-box input {
    border: none;
    outline: none;
    width: 100%;
    padding: 12px 0;
    font-size: 11px;
}

.toolbar select {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 12px;
    outline: none;
    color: #62667c;
    font-size: 11px;
    min-width: 145px;
}

.table-footer {
    border-top: 1px solid var(--border);
    margin-top: 12px;
    padding-top: 18px;
    color: var(--muted);
    font-size: 11px;
}

/* MODAL */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 18, 45, .55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 300;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    background: white;
    padding: 27px;
    border-radius: 15px;
    animation: appear .2s ease;
}

@keyframes appear {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
}

.modal-header h2 {
    font-size: 19px;
}

.modal-header p {
    color: var(--muted);
    font-size: 11px;
    margin-top: 6px;
}

.close-modal {
    background: none;
    font-size: 27px;
    color: #999;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 17px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 11px;
    font-weight: 600;
}

.form-group input, .form-group select, .form-group textarea {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    outline: none;
    font-size: 11px;
    width: 100%;
    background: white;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, .1);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
}

/* TOAST */
.toast {
    position: fixed;
    right: 25px;
    bottom: 25px;
    padding: 14px 20px;
    border-radius: 9px;
    background: #20243a;
    color: white;
    font-size: 12px;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: .3s;
    z-index: 500;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    background: #c0394b;
}

/* RESPONSIVE */
@media(max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media(max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
        width: 100%;
    }

    .menu-toggle {
        display: block;
    }

    .topbar {
        padding: 0 17px;
    }

    .content {
        padding: 23px 15px;
    }

    .welcome {
        align-items: flex-start;
        flex-direction: column;
    }

    .stats-grid {
        gap: 10px;
    }

    .stat-card {
        padding: 15px 10px;
        gap: 9px;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }

    .stat-card h2 {
        font-size: 20px;
    }

    .stat-card span {
        font-size: 9px;
    }

    .panel {
        padding: 15px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full {
        grid-column: auto;
    }

    .top-right .status {
        display: none;
    }
}

@media(max-width: 400px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
