/* SOGAM Prospect — charte SOGAM : vert #1E8B3A, rouge #E30613, blanc, noir #1A1A1A */
:root {
  --vert: #1E8B3A; --vert-fonce: #166B2C; --vert-clair: #E8F4EC; --vert-tres-clair: #F4FAF6;
  --rouge: #E30613; --rouge-clair: #FDECEC; --orange: #C26A00; --orange-clair: #FFF4E5; --bleu: #1F5FA8; --bleu-clair: #EAF1FA;
  --noir: #1A1A1A; --gris-1: #4A4F55; --gris-2: #6B7178; --gris-3: #A9AEB4; --gris-4: #DDE1E5; --gris-5: #EEF0F2; --fond: #F6F7F8; --blanc: #FFFFFF;
  --rayon: 10px; --ombre: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --police: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --barre-bas: 64px; --side: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--police); color: var(--noir); background: var(--fond); font-size: 15px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
a { color: var(--vert-fonce); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.2; font-weight: 700; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; } h4 { font-size: .9rem; color: var(--gris-1); }
.muted { color: var(--gris-2); } .small { font-size: .82rem; } .nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hidden { display: none !important; }
hr { border: 0; border-top: 1px solid var(--gris-4); margin: 1rem 0; }

/* ---------- Structure ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side); background: var(--vert); color: #fff; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 20; }
.side .brand { padding: 18px 18px 12px; border-bottom: 1px solid rgba(255,255,255,.15); }
.brand-logo { display: inline-flex; align-items: center; justify-content: center; background: #fff; color: var(--vert); font-weight: 900; letter-spacing: 1px; border-radius: 6px; padding: 4px 10px; font-size: 1.05rem; }
.brand small { display: block; margin-top: 6px; color: #d9efe0; font-size: .75rem; }
.side nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.side nav a { display: flex; align-items: center; gap: 10px; color: #eaf6ee; padding: 9px 18px; font-size: .92rem; border-left: 3px solid transparent; }
.side nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.side nav a.actif { background: rgba(255,255,255,.14); border-left-color: #fff; color: #fff; font-weight: 600; }
.side nav .sep { margin: 10px 18px 4px; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #bfe3c9; }
.side .user { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.15); font-size: .82rem; }
.side .user a { color: #fff; }
.ico { width: 18px; height: 18px; flex: none; }
.main { flex: 1; margin-left: var(--side); min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 15; background: #fff; border-bottom: 1px solid var(--gris-4); display: flex; align-items: center; gap: 12px; padding: 10px 20px; }
.topbar .slogan { color: var(--rouge); font-style: italic; font-weight: 600; font-size: .85rem; white-space: nowrap; }
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--gris-4); border-radius: 20px; background: var(--fond); font-size: .95rem; }
.topbar .search svg { position: absolute; left: 11px; top: 10px; color: var(--gris-2); }
.search-results { position: absolute; top: 44px; left: 0; right: 0; background: #fff; border: 1px solid var(--gris-4); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 60vh; overflow: auto; z-index: 30; }
.search-results a, .search-results div { display: block; padding: 9px 12px; border-bottom: 1px solid var(--gris-5); color: var(--noir); }
.search-results a:hover { background: var(--vert-tres-clair); text-decoration: none; }
.bell { position: relative; background: none; border: 0; cursor: pointer; padding: 6px; color: var(--gris-1); }
.bell .pastille { position: absolute; top: 0; right: 0; background: var(--rouge); color: #fff; border-radius: 10px; font-size: .68rem; padding: 1px 5px; font-weight: 700; }
.content { padding: 20px; max-width: 1400px; width: 100%; }
.footer { margin-top: auto; padding: 14px 20px; color: var(--gris-2); font-size: .75rem; border-top: 1px solid var(--gris-4); background: #fff; }
.bottomnav { display: none; }
.mobile-only { display: none; }

@media (max-width: 900px) {
  .side { display: none; }
  .main { margin-left: 0; padding-bottom: calc(var(--barre-bas) + env(safe-area-inset-bottom)); }
  .topbar { padding: 8px 12px; gap: 8px; }
  .topbar .slogan, .desktop-only { display: none !important; }
  .mobile-only { display: initial; }
  .content { padding: 12px; }
  .footer { display: none; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--barre-bas) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: #fff; border-top: 1px solid var(--gris-4); z-index: 25; }
  .bottomnav a, .bottomnav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .7rem; color: var(--gris-2); background: none; border: 0; font-family: inherit; }
  .bottomnav a.actif { color: var(--vert); font-weight: 700; }
  .bottomnav .plus { width: 52px; height: 52px; flex: none; margin: -18px 8px 0; border-radius: 50%; background: var(--vert); color: #fff; box-shadow: 0 4px 12px rgba(30,139,58,.4); }
  .bottomnav .plus svg { width: 26px; height: 26px; }
}

/* ---------- Composants ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: #fff; border-radius: var(--rayon); box-shadow: var(--ombre); padding: 16px; margin-bottom: 14px; }
.card > h2, .card > h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card.flat { box-shadow: none; border: 1px solid var(--gris-4); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .g2, .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile { background: #fff; border-radius: var(--rayon); box-shadow: var(--ombre); padding: 14px; border-top: 3px solid var(--vert); cursor: default; }
.tile.link { cursor: pointer; } .tile.link:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.tile .lbl { font-size: .78rem; color: var(--gris-2); text-transform: uppercase; letter-spacing: .03em; }
.tile .val { font-size: 1.45rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: .78rem; color: var(--gris-2); margin-top: 2px; }
.tile.alerte { border-top-color: var(--rouge); } .tile.attention { border-top-color: var(--orange); }
.delta-up { color: var(--vert-fonce); } .delta-down { color: var(--rouge); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--gris-4); background: #fff; color: var(--noir);
  font-size: .9rem; font-weight: 600; cursor: pointer; font-family: inherit; line-height: 1.1; min-height: 38px; text-decoration: none !important; }
.btn:hover { background: var(--gris-5); }
.btn.primaire { background: var(--vert); border-color: var(--vert); color: #fff; } .btn.primaire:hover { background: var(--vert-fonce); }
.btn.danger { background: #fff; border-color: var(--rouge); color: var(--rouge); } .btn.danger:hover { background: var(--rouge-clair); }
.btn.lien { border: 0; background: none; color: var(--vert-fonce); padding: 4px 6px; min-height: 0; }
.btn.petit { padding: 5px 9px; font-size: .8rem; min-height: 30px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: .74rem; font-weight: 600; background: var(--gris-5); color: var(--gris-1); white-space: nowrap; }
.badge.vert { background: var(--vert-clair); color: var(--vert-fonce); } .badge.rouge { background: var(--rouge-clair); color: #B00510; }
.badge.orange { background: var(--orange-clair); color: #8A4B00; } .badge.bleu { background: var(--bleu-clair); color: var(--bleu); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }

/* Tables → cartes sur mobile */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.t th { text-align: left; font-weight: 600; color: var(--gris-1); background: var(--gris-5); padding: 8px 10px; white-space: nowrap; font-size: .8rem; position: sticky; top: 0; }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--gris-5); vertical-align: top; }
table.t tr.clic { cursor: pointer; } table.t tr.clic:hover td { background: var(--vert-tres-clair); }
table.t td.num, table.t th.num { text-align: right; }
@media (max-width: 700px) {
  table.t.resp thead { display: none; }
  table.t.resp, table.t.resp tbody, table.t.resp tr, table.t.resp td { display: block; width: 100%; }
  table.t.resp tr { background: #fff; border: 1px solid var(--gris-4); border-radius: 8px; margin-bottom: 8px; padding: 6px 4px; }
  table.t.resp td { border: 0; padding: 3px 8px; display: flex; justify-content: space-between; gap: 10px; text-align: right; }
  table.t.resp td::before { content: attr(data-l); color: var(--gris-2); font-size: .78rem; text-align: left; flex: none; max-width: 45%; }
  table.t.resp td.titre { font-weight: 700; font-size: .95rem; text-align: left; } table.t.resp td.titre::before { content: none; }
}

/* Listes de priorités */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--gris-5); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t1 { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.list .t2 { font-size: .8rem; color: var(--gris-2); }
.list .quick { display: flex; gap: 4px; flex: none; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--gris-4); background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--gris-1); }
.icon-btn:hover { background: var(--vert-clair); color: var(--vert-fonce); }
.icon-btn.ok { background: var(--vert); color: #fff; border-color: var(--vert); }
.empty { color: var(--gris-2); font-size: .88rem; padding: 10px 0; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 1rem; }
.count { background: var(--gris-5); border-radius: 10px; padding: 0 8px; font-size: .78rem; color: var(--gris-1); }
.count.rouge { background: var(--rouge); color: #fff; }

/* Formulaires */
.form { display: grid; gap: 12px; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 600; color: var(--gris-1); }
label.f .req { color: var(--rouge); }
input, select, textarea { font-family: inherit; font-size: 16px; padding: 9px 10px; border: 1px solid var(--gris-3); border-radius: 8px; background: #fff; color: var(--noir); width: 100%; min-height: 40px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--vert); outline-offset: 1px; }
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox] { width: auto; min-height: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--gris-3); background: #fff; border-radius: 18px; padding: 7px 12px; font-size: .85rem; cursor: pointer; font-family: inherit; color: var(--noir); }
.chip.on { background: var(--vert); border-color: var(--vert); color: #fff; font-weight: 600; }
.chip.rouge.on { background: var(--rouge); border-color: var(--rouge); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.filters > * { flex: 0 1 180px; }
.filters > .chips, .filters > .btn, .filters > label { flex: 0 0 auto; }
.filters input, .filters select { min-height: 36px; padding: 6px 8px; font-size: .88rem; }
.hint { font-size: .78rem; color: var(--gris-2); font-weight: 400; }
.alert { padding: 10px 12px; border-radius: 8px; font-size: .88rem; margin-bottom: 10px; }
.alert.err { background: var(--rouge-clair); color: #8A0410; border: 1px solid #F5B5B8; }
.alert.warn { background: var(--orange-clair); color: #6B3B00; border: 1px solid #F3D19B; }
.alert.info { background: var(--bleu-clair); color: #173F6E; border: 1px solid #BCD3EE; }
.alert.ok { background: var(--vert-clair); color: #0F4D20; border: 1px solid #B6DCC1; }
.alert ul { margin: 4px 0 0 18px; padding: 0; }

/* Modale / bottom sheet */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 640px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 16px 48px rgba(0,0,0,.25); }
.modal.large { max-width: 920px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--gris-4); }
.modal-h h2 { margin: 0; }
.modal-b { padding: 16px; overflow-y: auto; }
.modal-f { padding: 12px 16px; border-top: 1px solid var(--gris-4); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@media (max-width: 700px) {
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal { max-height: 94vh; border-radius: 14px 14px 0 0; }
  .modal-f .btn { flex: 1; }
}
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; }
@media (max-width: 900px) { #toast-root { bottom: calc(var(--barre-bas) + 16px); } }
.toast { background: var(--noir); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: .9rem; box-shadow: 0 6px 18px rgba(0,0,0,.25); max-width: 90vw; }
.toast.err { background: #8A0410; } .toast.ok { background: var(--vert-fonce); }

/* Kanban */
.kanban { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.col { background: var(--gris-5); border-radius: 10px; min-width: 250px; width: 250px; flex: none; display: flex; flex-direction: column; max-height: calc(100vh - 210px); }
.col-h { padding: 10px 12px; border-bottom: 1px solid var(--gris-4); }
.col-h .t { font-weight: 700; font-size: .88rem; display: flex; justify-content: space-between; }
.col-h .m { font-size: .76rem; color: var(--gris-2); }
.col-b { padding: 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 80px; }
.col.drop { outline: 2px dashed var(--vert); }
.kcard { background: #fff; border-radius: 8px; padding: 10px; box-shadow: var(--ombre); cursor: grab; border-left: 3px solid var(--vert); font-size: .84rem; }
.kcard.orange { border-left-color: var(--orange); } .kcard.rouge { border-left-color: var(--rouge); }
.kcard .n { font-weight: 700; margin-bottom: 2px; }
.kcard .p { color: var(--gris-2); font-size: .78rem; }
.kcard .m { display: flex; justify-content: space-between; margin-top: 6px; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--gris-5); border-radius: 3px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--vert); border-radius: 3px; }
.bar.rouge > span { background: var(--rouge); } .bar.orange > span { background: var(--orange); }

/* Jauge objectif */
.gauge { display: flex; flex-direction: column; gap: 6px; }
.gauge .bar { height: 12px; border-radius: 6px; position: relative; overflow: visible; }
.gauge .bar > span { border-radius: 6px; }
.gauge .marker { position: absolute; top: -4px; width: 2px; height: 20px; background: var(--noir); }
.gauge .lg { display: flex; justify-content: space-between; font-size: .8rem; color: var(--gris-2); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--gris-4); }
.timeline li { position: relative; padding: 0 0 14px 14px; }
.timeline li::before { content: ""; position: absolute; left: -21px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--vert); }
.timeline li.plan::before { border-color: var(--bleu); } .timeline li.retard::before { border-color: var(--rouge); background: var(--rouge); } .timeline li.note::before { border-color: var(--orange); }
.timeline .h { font-size: .8rem; color: var(--gris-2); }
.timeline .b { font-size: .9rem; white-space: pre-wrap; }

/* Onglets */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--gris-4); margin-bottom: 12px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-family: inherit; font-size: .9rem; color: var(--gris-1); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--vert-fonce); border-bottom-color: var(--vert); font-weight: 700; }

/* Étapes (frise) */
.steps { display: flex; gap: 4px; overflow-x: auto; margin: 6px 0 12px; }
.steps .s { flex: 1; min-width: 88px; text-align: center; font-size: .72rem; padding: 6px 4px; background: var(--gris-5); color: var(--gris-2); border-radius: 4px; }
.steps .s.fait { background: var(--vert-clair); color: var(--vert-fonce); } .steps .s.cour { background: var(--vert); color: #fff; font-weight: 700; }

/* Graphiques */
.chart { width: 100%; }
.chart text { font-family: var(--police); font-size: 11px; fill: var(--gris-2); }
.hbar { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; gap: 6px 10px; align-items: center; font-size: .84rem; }
.hbar .b { height: 14px; background: var(--gris-5); border-radius: 0 4px 4px 0; }
.hbar .b > span { display: block; height: 100%; background: var(--vert); border-radius: 0 4px 4px 0; }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--gris-1); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 4px; vertical-align: -2px; }

/* Connexion */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(160deg, var(--vert) 0%, var(--vert-fonce) 100%); }
.login .box { background: #fff; border-radius: 14px; padding: 28px 24px; width: 100%; max-width: 400px; box-shadow: 0 20px 48px rgba(0,0,0,.25); }
.login .slogan { color: var(--rouge); font-style: italic; font-weight: 600; font-size: .88rem; margin: 6px 0 18px; }

/* Impression (rapports) */
.print-head { display: none; }
@media print {
  .side, .topbar, .bottomnav, .footer, .no-print, #toast-root { display: none !important; }
  .main { margin: 0; } .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .print-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--vert); padding-bottom: 8px; margin-bottom: 12px; }
  .print-head .slogan { color: var(--rouge); font-style: italic; }
  body { background: #fff; font-size: 12px; }
}
