/* =====================================================================
   IDH INTERNATIONAL - MALI  |  Identite visuelle du systeme de gestion
   Palette derivee du sceau officiel : bordeaux profond, or/ocre, ivoire,
   bleu "Liberez vos potentiels".
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Source+Sans+3:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
    --bordeaux-950: #2c0606;
    --bordeaux-900: #4a0e0e;
    --bordeaux-800: #641414;
    --bordeaux-700: #7c1c1c;
    --or-600: #a66a1e;
    --or-500: #c68a3e;
    --or-400: #d9a862;
    --or-100: #f4e6cc;
    --bleu-700: #1f5a85;
    --bleu-600: #2f6fa3;
    --bleu-100: #e3eef6;
    --ivoire-50: #faf7f2;
    --ivoire-100: #f2ece1;
    --encre-900: #221c19;
    --encre-700: #4a3f38;
    --encre-400: #8a7d73;
    --ligne: #e4d9c8;
    --succes: #2f7d5a;
    --succes-bg: #e5f3ec;
    --danger: #a23b3b;
    --danger-bg: #f8e9e9;
    --attention: #a66a1e;
    --attention-bg: #f7ecd9;
    --info: #2f6fa3;
    --info-bg: #e3eef6;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-card: 0 1px 2px rgba(44,6,6,0.06), 0 8px 24px -12px rgba(44,6,6,0.18);
    --shadow-pop: 0 12px 32px -8px rgba(44,6,6,0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--ivoire-50);
    color: var(--encre-900);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-display {
    font-family: var(--font-display);
    color: var(--bordeaux-900);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 .4em;
}
h1 { font-size: 2.1rem; font-weight: 700; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--bleu-700); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .text-sm { font-size: .85rem; }
.text-muted { color: var(--encre-400); }
.mono { font-family: var(--font-mono); letter-spacing: .04em; }

:focus-visible {
    outline: 3px solid var(--or-500);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------
   Motif "sceau" -- signature visuelle reprise du logo officiel
   --------------------------------------------------------------- */
.seal-ring {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.seal-ring::before {
    content: '';
    position: absolute;
    inset: -10px;
    border: 1.5px dashed rgba(198,138,62,.55);
    border-radius: 50%;
}
.watermark-seal {
    position: absolute;
    right: -60px;
    top: -60px;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(198,138,62,.10) 0%, rgba(198,138,62,0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* ---------------------------------------------------------------
   Boutons
   --------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5em;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: .95rem;
    padding: .68em 1.4em;
    border-radius: var(--radius-sm);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background-color .15s ease, border-color .15s ease;
    text-decoration: none;
    line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--bordeaux-900); color: #fff; }
.btn-primary:hover { background: var(--bordeaux-800); }

.btn-gold { background: var(--or-500); color: #2c0606; }
.btn-gold:hover { background: var(--or-600); color: #fff; }

.btn-outline { background: transparent; border-color: var(--bordeaux-900); color: var(--bordeaux-900); }
.btn-outline:hover { background: var(--bordeaux-900); color: #fff; }

.btn-ghost { background: transparent; color: var(--encre-700); border-color: var(--ligne); }
.btn-ghost:hover { background: var(--ivoire-100); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #832e2e; }

.btn-sm { padding: .4em 1em; font-size: .82rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------------------------------------------------------
   Cartes / conteneurs
   --------------------------------------------------------------- */
.card {
    background: #fff;
    border: 1px solid var(--ligne);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}
.card-body { padding: 1.6rem; }
.card-header {
    padding: 1.1rem 1.6rem;
    border-bottom: 1px solid var(--ligne);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h2, .card-header h3 { margin: 0; }

.stat-card {
    background: #fff;
    border: 1px solid var(--ligne);
    border-radius: var(--radius-md);
    padding: 1.3rem 1.4rem;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}
.stat-card .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--encre-400); font-weight: 600; }
.stat-card .value { font-family: var(--font-display); font-size: 2rem; color: var(--bordeaux-900); font-weight: 700; margin-top: .15em; }
.stat-card .sub { font-size: .82rem; color: var(--encre-400); margin-top: .3em; }
.stat-card::after {
    content: '';
    position: absolute;
    right: -18px; bottom: -18px;
    width: 90px; height: 90px;
    border-radius: 50%;
    background: var(--stat-tint, rgba(198,138,62,.12));
}

/* ---------------------------------------------------------------
   Formulaires
   --------------------------------------------------------------- */
.form-group { margin-bottom: 1.15rem; }
label { display: block; font-weight: 600; font-size: .88rem; color: var(--encre-700); margin-bottom: .4em; }
label .req { color: var(--danger); }

input[type=text], input[type=password], input[type=tel], input[type=number],
input[type=date], input[type=email], input[type=file], select, textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: .96rem;
    padding: .68em .85em;
    border: 1.5px solid var(--ligne);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--encre-900);
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--or-500);
    box-shadow: 0 0 0 3px rgba(198,138,62,.18);
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%234a3f38' stroke-width='1.6' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .9em center; padding-right: 2.2em; }
textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: .8rem; color: var(--encre-400); margin-top: .35em; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.15rem; }
@media (max-width: 720px) { .form-row { grid-template-columns: 1fr; } }

.tel-group { display: flex; align-items: stretch; }
.tel-group .tel-prefix {
    display: flex; align-items: center; padding: 0 .8em; border: 1.5px solid var(--ligne); border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--ivoire-100); color: var(--encre-700);
    font-weight: 700; font-size: .92rem; white-space: nowrap;
}
.tel-group input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.otp-input {
    letter-spacing: .5em;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 600;
}

/* ---------------------------------------------------------------
   Alertes / badges
   --------------------------------------------------------------- */
.alert { padding: .9em 1.1em; border-radius: var(--radius-sm); margin-bottom: 1.2rem; font-size: .92rem; border: 1px solid transparent; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.alert .alert-text { flex: 1; }
.alert .alert-close { flex-shrink: 0; background: none; border: none; cursor: pointer; font-size: 1.3rem; line-height: 1; color: inherit; opacity: .6; padding: 0 .2em; }
.alert .alert-close:hover { opacity: 1; }
.alert-success { background: var(--succes-bg); color: var(--succes); border-color: rgba(47,125,90,.25); }
.alert-danger  { background: var(--danger-bg); color: var(--danger); border-color: rgba(162,59,59,.25); }
.alert-info    { background: var(--info-bg); color: var(--info); border-color: rgba(47,111,163,.25); }
.alert-warning { background: var(--attention-bg); color: var(--attention); border-color: rgba(166,106,30,.25); }

.badge { display: inline-flex; align-items: center; gap: .3em; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .3em .7em; border-radius: 999px; }
.badge-success { background: var(--succes-bg); color: var(--succes); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--attention-bg); color: var(--attention); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-gold { background: var(--or-100); color: var(--or-600); }

/* ---------------------------------------------------------------
   Tables
   --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--ligne); }
table { width: 100%; border-collapse: collapse; background: #fff; font-size: .92rem; }
thead th {
    text-align: left;
    background: var(--bordeaux-900);
    color: var(--or-100);
    font-weight: 600;
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .8em 1em;
    white-space: nowrap;
}
tbody td { padding: .75em 1em; border-top: 1px solid var(--ligne); vertical-align: middle; }
tbody tr:hover { background: var(--ivoire-100); }
tfoot td { padding: .75em 1em; font-weight: 700; border-top: 2px solid var(--bordeaux-900); }

/* ---------------------------------------------------------------
   Mise en page generale : landing
   --------------------------------------------------------------- */
.public-header {
    background: linear-gradient(180deg, var(--bordeaux-950) 0%, var(--bordeaux-900) 100%);
    color: #fff;
    padding: 1rem 0;
}
.public-header .wrap { max-width: 1180px; margin: 0 auto; padding: 0 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: .8rem; color: #fff; }
.brand img { width: 46px; height: 46px; border-radius: 50%; }
.brand .name { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.brand .slogan { font-size: .72rem; color: var(--or-400); text-transform: uppercase; letter-spacing: .08em; }

.hero {
    position: relative;
    background: radial-gradient(1200px 600px at 85% -10%, rgba(198,138,62,.18), transparent 60%),
                linear-gradient(160deg, var(--bordeaux-950) 0%, var(--bordeaux-900) 55%, var(--bordeaux-800) 100%);
    color: #fff;
    padding: 5.5rem 1.5rem 6rem;
    overflow: hidden;
}
.hero .wrap { max-width: 1180px; margin: 0 auto; position: relative; z-index: 2; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: center; }
@media (max-width: 880px) { .hero-grid { grid-template-columns: 1fr; text-align: center; } }
.eyebrow { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--or-400); font-weight: 700; margin-bottom: 1rem; }
.hero h1 { color: #fff; font-size: 2.7rem; line-height: 1.12; margin-bottom: .55em; }
.hero h1 em { color: var(--or-400); font-style: normal; }
.hero p.lead { color: rgba(255,255,255,.82); font-size: 1.08rem; max-width: 46ch; }
.hero-actions { display: flex; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }
@media (max-width: 880px) { .hero-actions { justify-content: center; } }
.hero-seal { display: flex; justify-content: center; }
.hero-seal img { width: 100%; max-width: 340px; border-radius: 50%; box-shadow: var(--shadow-pop); }

.section { padding: 4.5rem 1.5rem; }
.section .wrap { max-width: 1180px; margin: 0 auto; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 3rem; }
.filiere-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.filiere-item {
    background: #fff; border: 1px solid var(--ligne); border-radius: var(--radius-md);
    padding: 1.1rem 1.3rem; font-size: .9rem; font-weight: 600; color: var(--bordeaux-900);
    display: flex; align-items: center; gap: .7rem;
}
.filiere-item .num { font-family: var(--font-mono); font-size: .75rem; color: var(--or-600); background: var(--or-100); border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
@media (max-width: 880px) { .pillars { grid-template-columns: 1fr; } }
.pillar { background: #fff; border: 1px solid var(--ligne); border-radius: var(--radius-lg); padding: 1.8rem; box-shadow: var(--shadow-card); }
.pillar .icon { width: 46px; height: 46px; border-radius: 50%; background: var(--bordeaux-900); color: var(--or-400); display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; font-family: var(--font-display); font-weight: 700; }

.public-footer { background: var(--bordeaux-950); color: rgba(255,255,255,.6); text-align: center; padding: 2rem 1.5rem; font-size: .85rem; }

/* ---------------------------------------------------------------
   Pages d'authentification
   --------------------------------------------------------------- */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--ivoire-50);
}
@media (max-width: 900px) { .auth-shell { grid-template-columns: 1fr; } }
.auth-visual {
    background: linear-gradient(160deg, var(--bordeaux-950), var(--bordeaux-800));
    color: #fff;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 3rem; text-align: center; position: relative;
}
.auth-visual img { width: 150px; margin-bottom: 1.5rem; border-radius: 50%; box-shadow: var(--shadow-pop); }
.auth-visual h2 { color: #fff; }
.auth-visual p { color: rgba(255,255,255,.75); max-width: 34ch; }
@media (max-width: 900px) { .auth-visual { padding: 2.2rem 1.5rem; } .auth-visual img { width: 88px; margin-bottom: .8rem; } }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; }
.auth-form { width: 100%; max-width: 420px; }
.auth-tabs { display: flex; border: 1.5px solid var(--ligne); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 1.8rem; }
.auth-tabs a { flex: 1; text-align: center; padding: .75em .5em; font-size: .85rem; font-weight: 700; color: var(--encre-700); background: #fff; text-decoration: none; }
.auth-tabs a.active { background: var(--bordeaux-900); color: #fff; }

/* ---------------------------------------------------------------
   Tableau de bord (mise en page applicative)
   --------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 260px; flex-shrink: 0;
    background: linear-gradient(180deg, var(--bordeaux-950), var(--bordeaux-900));
    color: #fff;
    padding: 1.5rem 1.1rem;
    position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 60;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-pop);
}
.sidebar.open { transform: translateX(0); }
.sidebar-close {
    display: block; margin-left: auto; background: none; border: none; color: #fff;
    font-size: 1.6rem; line-height: 1; cursor: pointer; opacity: .7; padding: 0 .2em .6rem;
}
.sidebar-close:hover { opacity: 1; }
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(20,4,4,.45); z-index: 55;
}
.sidebar-overlay.show { display: block; }
.menu-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1.5px solid var(--ligne);
    background: #fff; color: var(--bordeaux-900); font-size: 1.2rem; cursor: pointer; flex-shrink: 0;
}
.menu-toggle:hover { background: var(--ivoire-100); }

@media (min-width: 1100px) {
    .sidebar { position: sticky; transform: none; box-shadow: none; }
    .sidebar-close, .menu-toggle, .sidebar-overlay { display: none; }
    .app-shell { display: flex; }
}
@media (max-width: 1099px) {
    .app-shell { display: block; }
    .main-content { width: 100%; }
}

.sidebar .brand-mini { display: flex; align-items: center; gap: .7rem; padding: 0 .4rem .5rem; margin-bottom: 1rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar .brand-mini img { width: 40px; height: 40px; border-radius: 50%; }
.sidebar .brand-mini .name { font-family: var(--font-display); font-weight: 700; font-size: .88rem; line-height: 1.2; }
.sidebar .brand-mini .role { font-size: .68rem; color: var(--or-400); text-transform: uppercase; letter-spacing: .06em; }
.sidebar nav { display: flex; flex-direction: column; gap: .15rem; margin-top: .8rem; }
.sidebar nav a {
    color: rgba(255,255,255,.78); text-decoration: none; font-size: .89rem; font-weight: 500;
    padding: .68em .8em; border-radius: var(--radius-sm); display: flex; align-items: center; gap: .6em;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar nav a.active { background: var(--or-500); color: var(--bordeaux-950); font-weight: 700; }
.sidebar .nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.4); margin: 1.1rem .8rem .3rem; }
.sidebar .logout-link { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.12); }

.main-content { flex: 1; min-width: 0; }
.topbar {
    background: #fff; border-bottom: 1px solid var(--ligne);
    padding: 1rem 2rem; display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 1.35rem; margin: 0; }
.topbar .user-chip { display: flex; align-items: center; gap: .6rem; font-size: .88rem; }
.topbar .user-chip .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--or-100); color: var(--or-600); display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--font-display); }
.content-inner { padding: 2rem; max-width: 1320px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.1rem; margin-bottom: 2rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--encre-400); }
.empty-state .icon { font-size: 2.4rem; margin-bottom: .5rem; }

.progress-track { width: 100%; height: 10px; border-radius: 999px; background: var(--ivoire-100); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--or-500), var(--or-600)); border-radius: 999px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.search-box { position: relative; max-width: 340px; flex: 1; }
.search-box input { padding-left: 2.4em; }
.search-box::before { content: '⌕'; position: absolute; left: .8em; top: 50%; transform: translateY(-50%); color: var(--encre-400); font-size: 1.1rem; }

.tab-nav { display: flex; gap: .3rem; border-bottom: 1.5px solid var(--ligne); margin-bottom: 1.6rem; }
.tab-nav a { padding: .7em 1.1em; font-size: .88rem; font-weight: 600; color: var(--encre-400); text-decoration: none; border-bottom: 2.5px solid transparent; margin-bottom: -1.5px; }
.tab-nav a.active { color: var(--bordeaux-900); border-color: var(--or-500); }

/* ---------------------------------------------------------------
   Documents imprimables (bulletin / recu) — voir print.css
   --------------------------------------------------------------- */
.doc-actions { max-width: 820px; margin: 0 auto 1rem; display: flex; justify-content: flex-end; gap: .7rem; }
.doc-sheet {
    max-width: 820px; margin: 0 auto 3rem; background: #fff; border: 1px solid var(--ligne);
    box-shadow: var(--shadow-card); padding: 3rem 3.2rem; border-radius: var(--radius-md);
}
.doc-head { display: flex; align-items: center; gap: 1.1rem; border-bottom: 3px solid var(--bordeaux-900); padding-bottom: 1.2rem; margin-bottom: 1.5rem; }
.doc-head img { width: 64px; height: 64px; border-radius: 50%; }
.doc-head .titles h2 { margin: 0; font-size: 1.15rem; }
.doc-head .titles .sub { font-size: .78rem; color: var(--encre-400); text-transform: uppercase; letter-spacing: .06em; }
.doc-title { text-align: center; margin: 1.6rem 0; }
.doc-title h1 { font-size: 1.5rem; margin-bottom: .2em; }
.doc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem 2rem; font-size: .92rem; margin-bottom: 1.6rem; background: var(--ivoire-100); padding: 1.1rem 1.3rem; border-radius: var(--radius-sm); }
.doc-meta div span.k { color: var(--encre-400); display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; }
.doc-signature { display: flex; justify-content: space-between; margin-top: 3rem; }
.doc-signature .box { text-align: center; font-size: .85rem; }
.doc-stamp { width: 90px; height: 90px; border: 2px dashed var(--or-500); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto .5rem; color: var(--or-600); font-family: var(--font-display); font-size: .72rem; text-align: center; line-height: 1.2; }

/* ---------------------------------------------------------------
   Divers
   --------------------------------------------------------------- */
.container-narrow { max-width: 760px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.chip-list { display: flex; flex-wrap: wrap; gap: .5rem; }
hr.divider { border: none; border-top: 1px solid var(--ligne); margin: 1.6rem 0; }
