/* ─── Reset & base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-primary:   #4F46E5;
    --color-primary-h: #4338CA;
    --color-bg:        #F8F7F4;
    --color-surface:   #FFFFFF;
    --color-border:    #E5E3DB;
    --color-text:      #1C1C1A;
    --color-muted:     #6B6B66;
    --color-success:   #059669;
    --color-danger:    #DC2626;
    --color-warning:   #D97706;
    --sidebar-w:       240px;
    --radius:          8px;
    --shadow:          0 1px 3px rgba(0,0,0,.08);
}

body { font-family: system-ui, -apple-system, sans-serif; font-size: 15px;
       line-height: 1.6; color: var(--color-text); background: var(--color-bg); }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Flash ─── */
.flash { display: flex; align-items: center; justify-content: space-between;
         padding: .75rem 1.25rem; font-size: 14px; }
.flash--success { background: #D1FAE5; color: #065F46; }
.flash--error   { background: #FEE2E2; color: #991B1B; }
.flash--info    { background: #DBEAFE; color: #1E40AF; }
.flash__close   { background: none; border: none; cursor: pointer; font-size: 18px;
                  line-height: 1; color: inherit; opacity: .6; }
.flash__close:hover { opacity: 1; }

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

.sidebar { width: var(--sidebar-w); background: var(--color-surface);
           border-right: 1px solid var(--color-border);
           display: flex; flex-direction: column; flex-shrink: 0; }

.sidebar__logo { display: flex; align-items: center; gap: 10px;
                 padding: 1.25rem 1rem; border-bottom: 1px solid var(--color-border);
                 font-weight: 600; font-size: 16px; }

.sidebar__nav { flex: 1; padding: .75rem .5rem; display: flex; flex-direction: column; gap: 2px; }

.nav-item { display: flex; align-items: center; gap: 10px; padding: .5rem .75rem;
            border-radius: var(--radius); color: var(--color-muted); font-size: 14px; }
.nav-item:hover { background: var(--color-bg); color: var(--color-text); text-decoration: none; }
.nav-item--active { background: #EEF2FF; color: var(--color-primary); font-weight: 500; }
.sidebar__sep { border: none; border-top: 1px solid var(--color-border); margin: .5rem 0; }

.sidebar__user { padding: 1rem; border-top: 1px solid var(--color-border); font-size: 13px; }
.sidebar__user-name { display: block; font-weight: 500; }
.sidebar__user-role { display: block; color: var(--color-muted); margin-bottom: .5rem; }
.sidebar__logout { color: var(--color-danger); font-size: 13px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar { display: flex; align-items: center; justify-content: space-between;
          padding: 1rem 1.5rem; background: var(--color-surface);
          border-bottom: 1px solid var(--color-border); }
.topbar__title { font-size: 18px; font-weight: 600; }

.content { padding: 1.5rem; }

/* ─── Formulaires ─── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: .4rem; }
.form-input  { width: 100%; padding: .6rem .875rem; border: 1px solid var(--color-border);
               border-radius: var(--radius); font-size: 15px; background: var(--color-surface); }
.form-input:focus { outline: none; border-color: var(--color-primary);
                    box-shadow: 0 0 0 3px rgba(79,70,229,.15); }

/* ─── Boutons ─── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: .6rem 1.25rem;
       border-radius: var(--radius); font-size: 14px; font-weight: 500;
       cursor: pointer; border: 1px solid transparent; transition: .15s; }
.btn--primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn--primary:hover { background: var(--color-primary-h); border-color: var(--color-primary-h); }
.btn--ghost { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn--ghost:hover { background: var(--color-bg); }
.btn--full { width: 100%; justify-content: center; }
.btn--danger { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }

/* ─── Login ─── */
.login-page { background: var(--color-bg); }
.login-container { display: flex; align-items: center; justify-content: center;
                   min-height: 100vh; padding: 2rem; }
.login-card { background: var(--color-surface); border: 1px solid var(--color-border);
              border-radius: 12px; padding: 2.5rem; width: 100%; max-width: 400px;
              box-shadow: var(--shadow); }
.login-card__header { text-align: center; margin-bottom: 2rem; }
.login-card__title  { font-size: 22px; font-weight: 700; }
.login-card__subtitle { color: var(--color-muted); font-size: 14px; margin-top: .25rem; }

/* ─── Cards ─── */
.card { background: var(--color-surface); border: 1px solid var(--color-border);
        border-radius: var(--radius); padding: 1.25rem; }
.card + .card { margin-top: 1rem; }

/* ─── Badges ─── */
.badge { display: inline-flex; align-items: center; padding: .2rem .6rem;
         border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge--red    { background: #FEE2E2; color: #991B1B; }
.badge--amber  { background: #FEF3C7; color: #92400E; }
.badge--green  { background: #D1FAE5; color: #065F46; }
.badge--blue   { background: #DBEAFE; color: #1E40AF; }
.badge--gray   { background: #F3F4F6; color: #374151; }
