:root {
    --navy: #0e1b2a;
    --navy-2: #14263a;
    --gold: #d6a72c;
    --gold-soft: #fff6dc;
    --white: #ffffff;
    --bg: #f5f7fa;
    --text: #1d2939;
    --muted: #667085;
    --border: #e4e7ec;
    --danger: #b42318;
    --success: #067647;
    --shadow: 0 8px 30px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}
a { color: inherit; text-decoration: none; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #0e1b2a, #162b42);
}
.login-shell { width: 100%; max-width: 430px; }
.login-card {
    background: var(--white);
    border-radius: 18px;
    padding: 38px;
    box-shadow: 0 24px 70px rgba(0,0,0,.2);
}
.brand-mark, .brand-mini {
    display: grid;
    place-items: center;
    background: var(--gold);
    color: var(--navy);
    font-weight: 800;
}
.brand-mark {
    width: 58px; height: 58px; border-radius: 14px;
    margin-bottom: 24px;
}
.eyebrow {
    margin: 0 0 7px;
    font-size: 11px;
    letter-spacing: .14em;
    font-weight: 800;
    color: var(--gold);
}
h1 { margin: 0; font-size: 28px; color: var(--navy); }
h2 { margin: 0; font-size: 18px; }
.login-subtitle, .muted { color: var(--muted); }
.login-subtitle { line-height: 1.6; margin: 8px 0 26px; }

label {
    display: block;
    margin: 16px 0 7px;
    font-size: 13px;
    font-weight: 700;
}
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 12px 13px;
    font: inherit;
    background: #fff;
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(214,167,44,.12);
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 9px;
    padding: 11px 16px;
    font-weight: 700;
    cursor: pointer;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-secondary { background: #eef2f6; color: var(--navy); }
.btn-full { width: 100%; margin-top: 24px; }
.alert { padding: 11px 13px; border-radius: 9px; font-size: 13px; }
.alert-danger { background: #fef3f2; color: var(--danger); }
.login-footer { margin: 24px 0 0; text-align: center; color: var(--muted); font-size: 12px; }

.app { min-height: 100vh; display: flex; }
.sidebar {
    width: 250px; background: var(--navy); color: #dce5ef;
    position: fixed; inset: 0 auto 0 0; z-index: 30;
    display: flex; flex-direction: column;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 22px 18px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-mini { width: 38px; height: 38px; border-radius: 10px; }
.sidebar-brand strong { display: block; color: #fff; font-size: 13px; }
.sidebar-brand small { color: #94a3b8; font-size: 10px; }

.nav { padding: 15px 10px; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px; border-radius: 8px;
    margin-bottom: 3px; font-size: 13px; color: #cbd5e1;
}
.nav-item span { width: 18px; text-align: center; }
.nav-item:hover, .nav-item.active { background: var(--navy-2); color: #fff; }
.nav-item.active { box-shadow: inset 3px 0 0 var(--gold); }
.nav-separator { height: 1px; background: rgba(255,255,255,.08); margin: 12px 5px; }
.sidebar-footer {
    margin-top: auto; padding: 16px 18px;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: 11px; color: #94a3b8;
}
.status-dot {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    background: #12b76a; margin-right: 7px;
}

.main { margin-left: 250px; width: calc(100% - 250px); min-width: 0; }
.topbar {
    height: 66px; background: #fff; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 28px; gap: 16px;
    position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-weight: 800; color: var(--navy); }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 12px; }
.role-pill { background: var(--gold-soft); color: #7a5a00; padding: 6px 9px; border-radius: 99px; font-weight: 700; }
.user-name { font-weight: 700; }
.logout-link { color: var(--muted); }
.hamburger { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--navy); margin: 4px 0; }

.content { padding: 30px; max-width: 1500px; }
.page-heading { display: flex; justify-content: space-between; margin-bottom: 25px; }
.page-heading h1 { font-size: 25px; }
.stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px;
}
.stat-card, .panel {
    background: #fff; border: 1px solid var(--border);
    border-radius: 13px; box-shadow: var(--shadow);
}
.stat-card { padding: 20px; }
.stat-card.accent { border-top: 3px solid var(--gold); }
.stat-label { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-card strong { display: block; margin: 9px 0 4px; font-size: 30px; color: var(--navy); }
.stat-note { font-size: 11px; color: var(--muted); }
.panel { padding: 20px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.panel-heading p { margin: 5px 0 0; font-size: 12px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.badge { padding: 5px 8px; border-radius: 99px; font-size: 11px; background: #eef2f6; }
.badge-nouveau { background: #eff8ff; color: #175cd3; }
.badge-en_cours { background: #ecfdf3; color: var(--success); }
.badge-en_attente { background: #fffaeb; color: #b54708; }

@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 12px 0 30px rgba(0,0,0,.18);
    }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; width: 100%; }
    .hamburger { display: block; }
    .topbar { padding: 0 16px; }
    .user-name, .logout-link { display: none; }
    .content { padding: 20px 16px; }
}
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 15px; }
    .stat-card strong { font-size: 24px; }
    .panel { padding: 14px; }
    .panel-heading { align-items: flex-start; gap: 12px; }
    .panel-heading .btn { padding: 9px 10px; font-size: 11px; }
    .login-card { padding: 28px 22px; }
}
