/* ==========================================================================
   SINE-GN — Système d'information national de l'élevage (Guinée)
   Design system : institutionnel, lisible au soleil comme au bureau.
   ========================================================================== */
:root {
    --forest-950: #06231a;
    --forest-900: #0a3324;
    --forest-800: #0e4430;
    --forest-700: #135a3e;
    --green-600: #0f8a4f;
    --green-500: #14a35f;
    --green-100: #dcf4e6;
    --green-50: #eefaf3;
    --gold-500: #e8a91b;
    --gold-400: #f5c33b;
    --gold-100: #fdf1d3;
    --red-gn: #ce1126;
    --yellow-gn: #fcd116;
    --green-gn: #009460;

    --bg: #f5f6f1;
    --surface: #ffffff;
    --surface-2: #fafbf8;
    --line: #e4e8df;
    --line-strong: #d3d9cc;
    --text: #17221c;
    --text-2: #3d4a42;
    --muted: #6b776f;

    --info: #2563eb;      --info-bg: #e8effd;
    --success: #0f8a4f;   --success-bg: #e2f5ea;
    --warning: #b76e00;   --warning-bg: #fdf1d9;
    --orange: #d9520b;    --orange-bg: #fdeadf;
    --danger: #c8242f;    --danger-bg: #fbe6e7;
    --violet: #6d4ad8;    --violet-bg: #efeafd;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --shadow-xs: 0 1px 2px rgba(10, 40, 25, .06);
    --shadow: 0 1px 2px rgba(10, 40, 25, .05), 0 4px 14px -4px rgba(10, 40, 25, .08);
    --shadow-lg: 0 12px 40px -12px rgba(6, 35, 26, .28);
    --sidebar: 272px;
    --topbar: 68px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--green-600); text-decoration: none; }
a:hover { color: var(--forest-700); }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text); margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 750; }
h2 { font-size: 1.05rem; font-weight: 700; }
h3 { font-size: .95rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(232, 169, 27, .55); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.xs { font-size: .76rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .86em; letter-spacing: .01em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 1.25rem; }
.row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 1.25rem; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-side { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }

/* ---------- Tricolore guinéen ---------- */
.flag-bar { height: 4px; background: linear-gradient(90deg, var(--red-gn) 0 33.3%, var(--yellow-gn) 33.3% 66.6%, var(--green-gn) 66.6%); }

/* ==========================================================================
   Structure : barre latérale + contenu
   ========================================================================== */
.app { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
    display: flex; flex-direction: column;
    background:
        radial-gradient(120% 60% at 0% 0%, rgba(20, 163, 95, .18), transparent 60%),
        radial-gradient(90% 50% at 100% 100%, rgba(232, 169, 27, .10), transparent 60%),
        linear-gradient(180deg, var(--forest-900), var(--forest-950));
    color: #cfe3d8;
    transition: transform .25s ease;
}
.sidebar::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.035'%3E%3Cpath d='M0 40c40-20 80 20 160 0M0 80c40-20 80 20 160 0M0 120c40-20 80 20 160 0'/%3E%3C/g%3E%3C/svg%3E"); }
.brand { position: relative; display: flex; align-items: center; gap: .8rem; padding: 1.2rem 1.25rem 1rem; color: #fff; }
.brand-logo { width: 44px; height: 44px; border-radius: 13px; flex: none; display: grid; place-items: center;
    background: linear-gradient(145deg, var(--green-500), var(--forest-700)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.15), 0 6px 16px -6px rgba(0,0,0,.5); }
.brand-logo svg { width: 26px; height: 26px; }
.brand strong { display: block; font-family: var(--font-display); font-size: 1.12rem; letter-spacing: .02em; }
.brand span { display: block; font-size: .72rem; color: #9fc4b1; line-height: 1.3; }
.nav { position: relative; flex: 1; overflow-y: auto; padding: .25rem .8rem 1.2rem; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-title { margin: 1.1rem .7rem .4rem; font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #7fa892; }
.nav a { position: relative; display: flex; align-items: center; gap: .75rem; padding: .56rem .75rem; margin: 1px 0; border-radius: 10px; color: #d3e6dc; font-weight: 500; font-size: .92rem; transition: background .15s, color .15s; }
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: linear-gradient(90deg, rgba(20,163,95,.28), rgba(20,163,95,.08)); color: #fff; font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: -.8rem; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold-400); }
.nav a.active svg { opacity: 1; color: var(--gold-400); }
.nav .count { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 99px; background: var(--gold-500); color: var(--forest-950); font-size: .72rem; font-weight: 700; text-align: center; line-height: 20px; }
.sidebar-foot { position: relative; padding: .9rem 1.25rem 1.1rem; border-top: 1px solid rgba(255,255,255,.07); font-size: .72rem; color: #84a894; }
.sidebar-foot b { color: #cfe3d8; font-weight: 600; }

.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar); display: flex; align-items: center; gap: 1rem; padding: 0 1.75rem;
    background: rgba(245, 246, 241, .86); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid rgba(212, 218, 205, .7); }
.icon-btn.menu-btn { display: none; }
.search { flex: 1; max-width: 560px; position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search input { width: 100%; height: 42px; padding: 0 4.2rem 0 2.6rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s; }
.search input:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 4px rgba(20,163,95,.12); }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); padding: 2px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); font: 600 .7rem var(--font); color: var(--muted); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.icon-btn { position: relative; width: 42px; height: 42px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text-2); cursor: pointer; transition: border-color .15s, color .15s; }
.icon-btn:hover { border-color: var(--line-strong); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--red-gn); color: #fff; font-size: .65rem; font-weight: 700; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.user-btn { display: flex; align-items: center; gap: .65rem; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; }
.user-btn div strong { display: block; font-size: .86rem; line-height: 1.2; text-align: left; }
.user-btn div span { display: block; font-size: .72rem; color: var(--muted); text-align: left; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 36px; height: 36px; flex: none; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(145deg, var(--green-500), var(--forest-700)); color: #fff; font: 700 .8rem var(--font-display); letter-spacing: .02em; }
.avatar.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 1.3rem; }
.avatar.xl { width: 84px; height: 84px; border-radius: 22px; font-size: 1.7rem; }
.avatar.f { background: linear-gradient(145deg, #e0782f, #b4441b); }
.avatar.gold { background: linear-gradient(145deg, var(--gold-400), #c4830a); color: var(--forest-950); }

/* menus déroulants */
.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; padding: .4rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg); display: none; z-index: 50; }
.dropdown.open .menu { display: block; animation: pop .15s ease; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: .6rem; padding: .55rem .7rem; border: 0; border-radius: 9px; background: none; color: var(--text); font-size: .88rem; text-align: left; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--bg); }
.menu svg { width: 17px; height: 17px; color: var(--muted); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: .35rem 0; }
.menu-head { padding: .55rem .7rem .4rem; font-size: .75rem; color: var(--muted); }
.notif-menu { width: 360px; }
.notif { display: flex !important; gap: .7rem; align-items: flex-start !important; }
.notif .ico { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; }
.notif strong { display: block; font-size: .85rem; }
.notif small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.35; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

.content { flex: 1; padding: 1.6rem 1.75rem 2.5rem; width: 100%; max-width: 1520px; }
.footer { padding: 1rem 1.75rem 1.4rem; color: var(--muted); font-size: .78rem; display: flex; gap: 1rem; flex-wrap: wrap; justify-content: space-between; }

/* ---------- En-tête de page ---------- */
.page-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head .titles { flex: 1; min-width: 260px; }
.crumbs { display: flex; gap: .4rem; align-items: center; margin-bottom: .35rem; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--green-600); }
.crumbs svg { width: 13px; height: 13px; opacity: .6; }
.page-head p { margin: .3rem 0 0; color: var(--muted); }
.actions { display: flex; gap: .55rem; flex-wrap: wrap; }

/* ==========================================================================
   Composants
   ========================================================================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; height: 40px; padding: 0 1rem; border: 1px solid transparent; border-radius: 11px; font-weight: 600; font-size: .9rem; line-height: 1; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary { background: linear-gradient(180deg, var(--green-500), var(--green-600)); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 4px 12px -4px rgba(15,138,79,.6); }
.btn-primary:hover { background: linear-gradient(180deg, var(--green-600), var(--forest-700)); color: #fff; }
.btn-gold { background: var(--gold-500); color: var(--forest-950); }
.btn-gold:hover { background: var(--gold-400); color: var(--forest-950); }
.btn-light { background: var(--surface); border-color: var(--line); color: var(--text); box-shadow: var(--shadow-xs); }
.btn-light:hover { border-color: var(--line-strong); color: var(--text); background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(10,40,25,.05); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a71d27; color: #fff; }
.btn-danger-soft { background: var(--danger-bg); color: var(--danger); }
.btn-danger-soft:hover { background: #f6d2d4; color: #a71d27; }
.btn-warning-soft { background: var(--orange-bg); color: var(--orange); }
.btn-success-soft { background: var(--success-bg); color: var(--success); }
.btn-sm { height: 32px; padding: 0 .7rem; border-radius: 9px; font-size: .82rem; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { height: 48px; padding: 0 1.4rem; font-size: 1rem; border-radius: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.card-head h2 { flex: 1; display: flex; align-items: center; gap: .55rem; }
.card-head h2 svg { width: 18px; height: 18px; color: var(--green-600); }
.card-head .hint { font-size: .78rem; color: var(--muted); font-weight: 500; }
.card-body { padding: 1.25rem; }
.card-body.tight { padding: .75rem 1.25rem; }
.card-foot { padding: .85rem 1.25rem; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.card.flush .card-body { padding: 0; }

/* tuiles KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.1rem; margin-bottom: 1.4rem; }
.kpi { position: relative; overflow: hidden; padding: 1.15rem 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: var(--tint, var(--green-50)); opacity: .7; }
.kpi .ico { position: relative; z-index: 1; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--tint, var(--green-50)); color: var(--tone, var(--green-600)); }
.kpi .ico svg { width: 21px; height: 21px; }
.kpi .value { position: relative; z-index: 1; margin-top: .9rem; font: 750 1.75rem/1.1 var(--font-display); letter-spacing: -.02em; color: var(--text); }
.kpi .label { position: relative; z-index: 1; margin-top: .25rem; color: var(--muted); font-size: .86rem; }
.kpi .sub { position: relative; z-index: 1; margin-top: .65rem; display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--text-2); }
.kpi.hero { background: linear-gradient(135deg, var(--forest-800), var(--forest-950)); border-color: var(--forest-800); color: #e5f2ea; }
.kpi.hero::after { background: rgba(20,163,95,.25); }
.kpi.hero .value { color: #fff; }
.kpi.hero .label, .kpi.hero .sub { color: #a9cbb8; }
.kpi.hero .ico { background: rgba(255,255,255,.1); color: var(--gold-400); }
.tone-green { --tone: var(--green-600); --tint: var(--green-50); }
.tone-gold { --tone: #b0780a; --tint: var(--gold-100); }
.tone-blue { --tone: var(--info); --tint: var(--info-bg); }
.tone-red { --tone: var(--danger); --tint: var(--danger-bg); }
.tone-orange { --tone: var(--orange); --tint: var(--orange-bg); }
.tone-violet { --tone: var(--violet); --tint: var(--violet-bg); }

/* badges / pastilles */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 99px; font-size: .74rem; font-weight: 650; line-height: 1.4; white-space: nowrap; background: #eef0eb; color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.plain::before { display: none; }
.badge.success { background: var(--success-bg); color: var(--success); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.warning { background: var(--warning-bg); color: var(--warning); }
.badge.orange { background: var(--orange-bg); color: var(--orange); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.violet { background: var(--violet-bg); color: var(--violet); }
.badge.muted { background: #eef0eb; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); font-size: .76rem; font-weight: 600; color: var(--text-2); }
.chip svg { width: 13px; height: 13px; }

/* tableaux */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .89rem; }
.tbl th { position: sticky; top: 0; z-index: 1; padding: .7rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; text-align: left; white-space: nowrap; }
.tbl td { padding: .78rem 1rem; border-bottom: 1px solid #eef1ea; vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: #f9fbf6; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.clickable { cursor: pointer; }
.who { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.who strong { display: block; font-weight: 600; color: var(--text); }
.who small { display: block; color: var(--muted); font-size: .77rem; }
.who .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: .74rem; }

/* listes */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: .8rem; padding: .8rem 1.25rem; border-bottom: 1px solid #eef1ea; }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list strong { display: block; font-weight: 600; }
.list small { display: block; color: var(--muted); font-size: .79rem; }
.dl { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: .55rem 1rem; margin: 0; font-size: .9rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }

/* barres de progression */
.bar { height: 8px; border-radius: 99px; background: #edf0e9; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--green-500), var(--green-600)); }
.bar.gold > span { background: linear-gradient(90deg, var(--gold-400), var(--gold-500)); }
.bar.red > span { background: linear-gradient(90deg, #ef6b73, var(--danger)); }
.bar.blue > span { background: linear-gradient(90deg, #6aa1ff, var(--info)); }
.bar-row { display: grid; grid-template-columns: minmax(120px, 170px) 1fr 70px; gap: .8rem; align-items: center; padding: .42rem 0; font-size: .86rem; }
.bar-row .v { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }

/* jauge circulaire de score */
.score { --p: 0; --c: var(--green-600); position: relative; width: 108px; height: 108px; border-radius: 50%; display: grid; place-items: center; flex: none;
    background: conic-gradient(var(--c) calc(var(--p) * 1%), #e9ede5 0); }
.score::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--surface); }
.score b { position: relative; font: 800 1.6rem var(--font-display); letter-spacing: -.02em; }
.score small { position: absolute; bottom: 24px; font-size: .68rem; color: var(--muted); }
.score.sm { width: 54px; height: 54px; }
.score.sm::before { inset: 6px; }
.score.sm b { font-size: .86rem; }

/* onglets */
.tabs { display: flex; gap: .25rem; padding: 0 1rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { position: relative; display: inline-flex; align-items: center; gap: .45rem; padding: .9rem .8rem; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: .88rem; white-space: nowrap; cursor: pointer; }
.tabs a svg, .tabs button svg { width: 16px; height: 16px; }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs .active { color: var(--green-600); }
.tabs .active::after { content: ""; position: absolute; left: .5rem; right: .5rem; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--green-600); }
.tabs .count { padding: 0 .45rem; border-radius: 99px; background: #eef0eb; color: var(--text-2); font-size: .72rem; line-height: 1.6; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.pills { display: flex; gap: .4rem; flex-wrap: wrap; }
.pills a { display: inline-flex; align-items: center; gap: .4rem; padding: .42rem .85rem; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--text-2); font-size: .83rem; font-weight: 600; }
.pills a:hover { border-color: var(--green-500); color: var(--green-600); }
.pills a.active { background: var(--forest-800); border-color: var(--forest-800); color: #fff; }
.pills a .n { padding: 0 .45rem; border-radius: 99px; background: rgba(10,40,25,.07); font-size: .72rem; }
.pills a.active .n { background: var(--gold-500); color: var(--forest-950); }

/* étapes (workflow) */
.steps { display: flex; gap: 0; counter-reset: s; overflow-x: auto; padding: .25rem 0 .5rem; }
.step { position: relative; flex: 1; min-width: 110px; padding-top: 2.4rem; text-align: center; font-size: .76rem; color: var(--muted); }
.step::before { counter-increment: s; content: counter(s); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line-strong); font-weight: 700; font-size: .78rem; color: var(--muted); z-index: 1; }
.step::after { content: ""; position: absolute; top: 14px; left: calc(-50% + 15px); right: calc(50% + 15px); height: 2px; background: var(--line-strong); }
.step:first-child::after { display: none; }
.step.done { color: var(--text-2); }
.step.done::before { content: "✓"; background: var(--green-600); border-color: var(--green-600); color: #fff; }
.step.done::after { background: var(--green-600); }
.step.current { color: var(--text); font-weight: 650; }
.step.current::before { border-color: var(--gold-500); background: var(--gold-100); color: #8a5a00; box-shadow: 0 0 0 5px rgba(232,169,27,.15); }
.step.current::after { background: var(--green-600); }
.step.fail::before { content: "✕"; background: var(--danger); border-color: var(--danger); color: #fff; }

/* chronologie */
.timeline { list-style: none; margin: 0; padding: .4rem 1.25rem 1rem; }
.timeline li { position: relative; display: flex; gap: .85rem; padding: .7rem 0; }
.timeline li::before { content: ""; position: absolute; left: 15px; top: 2.4rem; bottom: -.4rem; width: 2px; background: #edf0e9; }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: relative; z-index: 1; width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--bg); color: var(--muted); }
.timeline .dot svg { width: 16px; height: 16px; }
.timeline .dot.success { background: var(--success-bg); color: var(--success); }
.timeline .dot.info { background: var(--info-bg); color: var(--info); }
.timeline .dot.warning { background: var(--warning-bg); color: var(--warning); }
.timeline .dot.danger { background: var(--danger-bg); color: var(--danger); }
.timeline .dot.orange { background: var(--orange-bg); color: var(--orange); }
.timeline .body { flex: 1; min-width: 0; font-size: .87rem; }
.timeline .body small { color: var(--muted); }
.diff { margin-top: .4rem; font-size: .78rem; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.diff div { display: grid; grid-template-columns: 34% 1fr 1fr; gap: .5rem; padding: .3rem .6rem; border-top: 1px solid #eef1ea; }
.diff div:first-child { border-top: 0; }
.diff .o { color: var(--danger); text-decoration: line-through; text-decoration-color: rgba(200,36,47,.35); overflow-wrap: anywhere; }
.diff .n { color: var(--success); overflow-wrap: anywhere; }

/* ==========================================================================
   Formulaires
   ========================================================================== */
.form-section { padding: 1.4rem 1.4rem .4rem; border-bottom: 1px solid var(--line); }
.form-section:last-of-type { border-bottom: 0; }
.form-section > header { display: flex; gap: .85rem; align-items: flex-start; margin-bottom: 1.15rem; }
.form-section > header .n { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--green-50); color: var(--green-600); font: 800 .9rem var(--font-display); }
.form-section > header p { margin: .15rem 0 0; font-size: .82rem; color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem 1.1rem; margin-bottom: 1rem; }
.f-12 { grid-column: span 12; } .f-8 { grid-column: span 8; } .f-6 { grid-column: span 6; } .f-4 { grid-column: span 4; } .f-3 { grid-column: span 3; } .f-2 { grid-column: span 2; }
.field label, .label { display: block; margin-bottom: .38rem; font-size: .83rem; font-weight: 600; color: var(--text-2); }
.field label .req { color: var(--danger); }
.input, .select, .textarea { width: 100%; height: 42px; padding: 0 .85rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.textarea { height: auto; min-height: 90px; padding: .65rem .85rem; resize: vertical; }
.select { appearance: none; padding-right: 2.2rem; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b776f' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right .7rem center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 4px rgba(20,163,95,.13); }
.input::placeholder, .textarea::placeholder { color: #a3ada6; }
.input-sm, .select-sm { height: 36px; font-size: .86rem; border-radius: 9px; }
.is-invalid { border-color: var(--danger) !important; }
.error { margin-top: .35rem; font-size: .78rem; color: var(--danger); font-weight: 550; }
.help { margin-top: .32rem; font-size: .77rem; color: var(--muted); }
.input-group { display: flex; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group .addon { display: grid; place-items: center; padding: 0 .8rem; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 10px 10px 0; background: var(--surface-2); color: var(--muted); font-size: .84rem; }
.check { display: flex; align-items: center; gap: .55rem; padding: .55rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: .88rem; transition: border-color .15s, background .15s; }
.check:hover { border-color: var(--line-strong); }
.check input { width: 18px; height: 18px; accent-color: var(--green-600); flex: none; }
.check:has(input:checked) { border-color: var(--green-500); background: var(--green-50); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .55rem; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface-2); }
.segmented label { margin: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: .45rem 1rem; border-radius: 8px; font-size: .86rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: var(--surface); color: var(--green-600); box-shadow: var(--shadow-xs); }
.segmented input:focus-visible + span { outline: 3px solid rgba(232,169,27,.55); }
.form-foot { position: sticky; bottom: 0; z-index: 5; display: flex; gap: .6rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; padding: .9rem 1.4rem; border-top: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(6px); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.gps-box { display: flex; gap: .8rem; align-items: center; padding: .8rem .9rem; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--surface-2); }
.gps-box .ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--info-bg); color: var(--info); flex: none; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; padding: .9rem 1.25rem; border-bottom: 1px solid var(--line); }
.filters .input, .filters .select { height: 38px; font-size: .87rem; width: auto; min-width: 150px; }
.filters .grow { flex: 1; min-width: 220px; position: relative; }
.filters .grow svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.filters .grow .input { width: 100%; padding-left: 2.2rem; }

/* ==========================================================================
   Alertes, toasts, états vides, modales
   ========================================================================== */
.alert { display: flex; gap: .8rem; align-items: flex-start; padding: .9rem 1.05rem; border: 1px solid; border-radius: 13px; font-size: .9rem; margin-bottom: 1.2rem; }
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.alert.success { background: var(--success-bg); border-color: #bfe6cf; color: #0b5f37; }
.alert.danger { background: var(--danger-bg); border-color: #f2c4c7; color: #8d1820; }
.alert.warning { background: var(--warning-bg); border-color: #f2dcaa; color: #7a4a00; }
.alert.info { background: var(--info-bg); border-color: #c9d9fb; color: #1e44a8; }
.alert ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.toasts { position: fixed; right: 1.4rem; bottom: 1.4rem; z-index: 90; display: flex; flex-direction: column; gap: .6rem; max-width: 420px; }
.toast { display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1rem; border-radius: 14px; background: var(--forest-900); color: #e9f5ee; box-shadow: var(--shadow-lg); animation: slidein .3s cubic-bezier(.2,.8,.2,1); font-size: .9rem; }
.toast.error { background: #6e1219; }
.toast svg { width: 20px; height: 20px; flex: none; color: var(--gold-400); }
.toast.error svg { color: #ffb4b9; }
.toast button { margin-left: auto; border: 0; background: none; color: inherit; opacity: .6; cursor: pointer; font-size: 1.1rem; line-height: 1; }
@keyframes slidein { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.empty { padding: 2.6rem 1.5rem; text-align: center; color: var(--muted); }
.empty .ico { width: 58px; height: 58px; margin: 0 auto .9rem; border-radius: 18px; display: grid; place-items: center; background: var(--green-50); color: var(--green-600); }
.empty .ico svg { width: 26px; height: 26px; }
.empty h3 { margin-bottom: .3rem; }
dialog.modal { width: min(560px, calc(100vw - 2rem)); padding: 0; border: 0; border-radius: 20px; box-shadow: var(--shadow-lg); color: var(--text); }
dialog.modal::backdrop { background: rgba(6, 35, 26, .45); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: pop .2s ease; }
.modal header { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--line); }
.modal header h2 { flex: 1; }
.modal .body { padding: 1.3rem; }
.modal footer { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem 1.3rem; border-top: 1px solid var(--line); background: var(--surface-2); }

/* pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .9rem 1.25rem; border-top: 1px solid var(--line); font-size: .84rem; color: var(--muted); }
.pager nav { display: flex; gap: .3rem; }
.pager a, .pager span.cur, .pager span.dis { min-width: 34px; height: 34px; padding: 0 .55rem; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text-2); font-weight: 600; }
.pager a:hover { border-color: var(--green-500); color: var(--green-600); }
.pager span.cur { background: var(--forest-800); border-color: var(--forest-800); color: #fff; }
.pager span.dis { opacity: .45; }

/* ==========================================================================
   Pages spécifiques
   ========================================================================== */
/* bannière de bienvenue */
.welcome { position: relative; overflow: hidden; display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; padding: 1.6rem 1.75rem; margin-bottom: 1.4rem; border-radius: 22px; color: #e3f1e9;
    background: radial-gradient(80% 140% at 100% 0%, rgba(232,169,27,.28), transparent 55%), radial-gradient(60% 120% at 0% 100%, rgba(20,163,95,.35), transparent 60%), linear-gradient(120deg, var(--forest-800), var(--forest-950)); box-shadow: var(--shadow-lg); }
.welcome::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 340px; height: 220px; opacity: .14;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 40'%3E%3Cpath fill='%23fff' d='M8 18c0-5 4-8 9-8h21c3 0 5-3 9-3 3 0 4 2 6 2l3-3 1 4c2 1 3 3 3 5 0 3-3 4-5 4h-2c-1 4-3 6-6 7v8h-4v-7H22v7h-4v-8c-5-1-8-4-8-8l-2 3-2-1 2-3z'/%3E%3C/svg%3E") no-repeat center / contain; }
.welcome h1 { color: #fff; font-size: 1.55rem; }
.welcome p { margin: .35rem 0 0; color: #b6d4c3; max-width: 640px; }
.welcome .actions { position: relative; z-index: 1; margin-left: auto; }
.welcome .btn-light { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; box-shadow: none; }
.welcome .btn-light:hover { background: rgba(255,255,255,.18); }

/* dossier éleveur */
.profile { display: flex; gap: 1.3rem; align-items: center; flex-wrap: wrap; padding: 1.4rem 1.5rem; }
.profile .ids { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.profile h1 { font-size: 1.5rem; }
.facts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.facts > div { padding: .95rem 1.3rem; border-left: 1px solid var(--line); }
.facts > div:first-child { border-left: 0; }
.facts b { display: block; font: 750 1.2rem var(--font-display); }
.facts span { font-size: .78rem; color: var(--muted); }
.decision-bar { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; padding: .95rem 1.3rem; border-top: 1px solid var(--line); background: linear-gradient(90deg, var(--gold-100), #fffaf0); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.decision-bar.validated { background: linear-gradient(90deg, var(--success-bg), #f5fbf7); }
.decision-bar.rejected, .decision-bar.correction_required { background: linear-gradient(90deg, var(--danger-bg), #fff8f8); }
.decision-bar p { flex: 1; margin: 0; font-size: .88rem; min-width: 220px; }
.species { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.species > div { padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.species b { display: block; font: 750 1.4rem var(--font-display); }
.species span { font-size: .8rem; color: var(--muted); }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: flex; gap: .75rem; align-items: flex-start; padding: .7rem 1.25rem; border-bottom: 1px solid #eef1ea; font-size: .88rem; }
.check-list li:last-child { border-bottom: 0; }
.check-list .mark { width: 24px; height: 24px; flex: none; border-radius: 8px; display: grid; place-items: center; }
.check-list .mark svg { width: 15px; height: 15px; }
.check-list .ok .mark { background: var(--success-bg); color: var(--success); }
.check-list .ko .mark { background: var(--danger-bg); color: var(--danger); }
.check-list .soft .mark { background: var(--warning-bg); color: var(--warning); }
.check-list small { display: block; color: var(--muted); }

/* carte */
.map { height: 560px; border-radius: 0 0 var(--radius-lg) var(--radius-lg); z-index: 0; }
.map.sm { height: 260px; border-radius: 12px; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.chart-box.lg { height: 320px; }

/* panier Tabaski */
.basket { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.basket > div { padding: 1rem; border-radius: 14px; text-align: center; background: var(--surface-2); border: 1px solid var(--line); }
.basket b { display: block; font: 800 clamp(1.25rem, 2.2vw, 1.8rem) var(--font-display); }
.basket span { font-size: .78rem; color: var(--muted); }
.basket .rest { background: var(--green-50); border-color: #bfe6cf; }
.basket .rest b { color: var(--green-600); }
.price-split { display: flex; height: 38px; border-radius: 11px; overflow: hidden; font-size: .8rem; font-weight: 700; }
.price-split div { display: grid; place-items: center; color: #fff; }
.price-split .etat { background: linear-gradient(90deg, var(--forest-700), var(--green-600)); }
.price-split .acteur { background: linear-gradient(90deg, var(--gold-500), #d4920f); color: var(--forest-950); }

/* page de connexion */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(420px, 1fr); background: var(--surface); }
.auth-art { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 2.6rem 3rem; color: #e3f1e9;
    background: radial-gradient(70% 60% at 85% 15%, rgba(232,169,27,.30), transparent 60%), radial-gradient(80% 70% at 10% 90%, rgba(20,163,95,.40), transparent 60%), linear-gradient(150deg, var(--forest-800), var(--forest-950) 70%); }
.auth-art::before { content: ""; position: absolute; inset: 0; opacity: .5; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.05' stroke-width='1.2'%3E%3Cpath d='M0 55c55-28 110 28 220 0M0 110c55-28 110 28 220 0M0 165c55-28 110 28 220 0'/%3E%3C/g%3E%3C/svg%3E"); }
.auth-art > * { position: relative; }
.auth-art h1 { color: #fff; font-size: 2.35rem; line-height: 1.15; max-width: 560px; letter-spacing: -.02em; }
.auth-art h1 em { font-style: normal; color: var(--gold-400); }
.auth-art p { color: #b6d4c3; max-width: 520px; font-size: 1.02rem; }
.auth-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; max-width: 560px; }
.auth-stats div { padding: 1rem 1.1rem; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; background: rgba(255,255,255,.05); backdrop-filter: blur(4px); }
.auth-stats b { display: block; font: 800 1.45rem var(--font-display); color: #fff; }
.auth-stats span { font-size: .78rem; color: #a9cbb8; }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 3rem clamp(1.5rem, 5vw, 4.5rem); }
.auth-form .box { width: 100%; max-width: 410px; margin: 0 auto; }
.auth-form h2 { font-size: 1.6rem; margin-bottom: .35rem; }
.republic { display: flex; align-items: center; gap: .8rem; }
.republic .flag { width: 42px; height: 28px; border-radius: 5px; overflow: hidden; display: flex; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.republic .flag i { flex: 1; }
.republic small { display: block; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: #a9cbb8; }
.republic strong { color: #fff; font-family: var(--font-display); }
.demo-accounts { margin-top: 1.5rem; padding: .9rem 1rem; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--surface-2); font-size: .8rem; color: var(--text-2); }
.demo-accounts button { border: 0; background: none; padding: .15rem 0; color: var(--green-600); font-weight: 600; cursor: pointer; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1280px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
    .g-main, .g-side, .g-3 { grid-template-columns: 1fr; }
    .auth { grid-template-columns: 1fr; }
    .auth-art { display: none; }
}
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: none; }
    .main { margin-left: 0; }
    .icon-btn.menu-btn { display: inline-grid; }
    .topbar { padding: 0 1rem; }
    .content { padding: 1.1rem 1rem 2rem; }
    .user-btn div { display: none; }
    .search kbd { display: none; }
    .f-8, .f-6, .f-4, .f-3, .f-2 { grid-column: span 12; }
    .g-2 { grid-template-columns: 1fr; }
    .notif-menu { width: calc(100vw - 2rem); right: -60px; }
    .overlay.open { position: fixed; inset: 0; z-index: 35; background: rgba(6,35,26,.4); }
}
@media (max-width: 560px) {
    .kpis { grid-template-columns: 1fr; }
    .g-4 { grid-template-columns: 1fr; }
    .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .basket { grid-template-columns: 1fr; }
    h1 { font-size: 1.35rem; }
    .bar-row { grid-template-columns: 95px 1fr 56px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ==========================================================================
   Impression (fiche éleveur, reçus, conventions)
   ========================================================================== */
.print-page { max-width: 820px; margin: 0 auto; padding: 2rem; background: #fff; }
.print-head { display: flex; align-items: center; gap: 1rem; padding-bottom: 1rem; margin-bottom: 1.4rem; border-bottom: 3px solid var(--forest-800); }
.print-head .flag { width: 48px; height: 32px; display: flex; border-radius: 4px; overflow: hidden; }
.print-head .flag i { flex: 1; }
.print-head h1 { font-size: 1.25rem; }
.print-head small { display: block; font-size: .72rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.print-section { margin-bottom: 1.3rem; break-inside: avoid; }
.print-section h2 { padding: .45rem .7rem; margin-bottom: .6rem; background: var(--green-50); border-left: 4px solid var(--green-600); font-size: .92rem; }
.print-grid { width: 100%; border-collapse: collapse; font-size: .86rem; }
.print-grid th, .print-grid td { padding: .38rem .55rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.print-grid th { width: 34%; background: var(--surface-2); font-weight: 600; color: var(--text-2); }
.signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 2.4rem; }
.signatures div { min-height: 110px; padding: .6rem; border-top: 1px solid var(--text); font-size: .82rem; }
@media print {
    body { background: #fff; font-size: 12px; }
    .no-print, .sidebar, .topbar, .toasts, .footer { display: none !important; }
    .main { margin: 0; }
    .print-page { padding: 0; max-width: none; }
    a { color: inherit; }
    @page { margin: 14mm; }
}
