:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #ca8a04;
    --info: #0891b2;
    --muted: #6b7280;
    --bg: #f4f6f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #1f2937;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.navbar {
    background: #111827;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    flex-wrap: wrap;
}

.navbar .brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    text-decoration: none;
}

.navbar nav a {
    color: #d1d5db;
    text-decoration: none;
    margin-left: 1.25rem;
    font-size: 0.92rem;
}

.navbar nav a:hover, .navbar nav a.active {
    color: #fff;
}

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

.navbar .user-box span {
    font-size: 0.85rem;
    color: #9ca3af;
}

.navbar .user-box a.logout {
    background: var(--danger);
    color: #fff;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
}

.container {
    max-width: 1100px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.card h2, .card h3 {
    margin-top: 0;
}

.grid {
    display: grid;
    gap: 1.25rem;
}

.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 768px) {
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.stat-card {
    text-align: center;
}

.stat-card .value {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .label {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th, table td {
    text-align: left;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}

.badge-warning { background: var(--warning); }
.badge-info { background: var(--info); }
.badge-success { background: var(--success); }
.badge-danger { background: var(--danger); }
.badge-muted { background: var(--muted); }

.btn {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    background: var(--primary);
}

.btn:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-muted { background: var(--muted); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0.75rem 0 0.3rem;
}

form input, form select, form textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success { background: #dcfce7; color: #166534; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-info { background: #dbeafe; color: #1e40af; }

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1f2937, #2563eb);
}

.login-box {
    background: #fff;
    padding: 2.5rem;
    border-radius: 14px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.login-box h1 {
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.text-muted { color: var(--muted); font-size: 0.85rem; }
.mt-1 { margin-top: 1rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* ---- Navigation par modules (app shell LHEUREUX) ---- */
.navbar nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-module {
    position: relative;
    color: #d1d5db;
    font-size: 0.92rem;
    margin-left: 1.25rem;
    cursor: pointer;
    padding: 0.3rem 0;
}

.nav-module:hover {
    color: #fff;
}

.nav-module-disabled {
    color: #4b5563;
    cursor: not-allowed;
}

.nav-module-disabled:hover {
    color: #4b5563;
}

.nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #1f2937;
    border-radius: 8px;
    padding: 0.4rem;
    min-width: 200px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    z-index: 50;
}

.nav-module:hover .nav-dropdown {
    display: block;
}

.nav-dropdown a {
    display: block;
    padding: 0.45rem 0.6rem;
    margin: 0 !important;
    border-radius: 6px;
    color: #e5e7eb !important;
    font-size: 0.85rem !important;
    white-space: nowrap;
}

.nav-dropdown a:hover {
    background: #374151;
    color: #fff !important;
}

.nav-dropdown-sep {
    height: 1px;
    background: #374151;
    margin: 0.3rem 0.2rem;
}

/* ---- Tuiles de modules (accueil de l'app) ---- */
.module-tile {
    text-decoration: none;
    color: var(--text);
    text-align: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.module-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.module-tile .module-icon {
    font-size: 2rem;
    margin-bottom: 0.4rem;
}

.module-tile h3 {
    margin: 0.2rem 0;
}

.module-tile-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
