:root {
  --navy: #073763; --blue: #0563C1; --blue-50: #eaf2fc; --ink: #1d2733; --muted: #5d6b7a; --line: #e2e7ee; --bg: #f4f6f9; --card: #fff;
  --ok: #1e8449; --ok-50: #e6f4ec; --warn: #b9770e; --warn-50: #fdf3e2; --late: #c0392b; --late-50: #fde8e6; --idle: #7b8794; --idle-50: #eef1f4;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --font: "Century Gothic", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); }
a { color: var(--blue); text-decoration: none; }
button { font: inherit; cursor: pointer; }
.boot { padding: 80px 20px; text-align: center; color: var(--muted); }

/* ---------- barre du haut ---------- */
.top { position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; }
.top-in { max-width: 1240px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 18px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; white-space: nowrap; }
.brand b { background: #fff; color: var(--navy); border-radius: 7px; padding: 3px 7px; font-size: 12px; }
.brand span { opacity: .8; font-weight: 400; }
.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { color: #cfe0f5; padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
.nav a.on, .nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.who { display: flex; align-items: center; gap: 10px; white-space: nowrap; font-size: 13px; }
.who .av { width: 30px; height: 30px; border-radius: 50%; background: var(--blue); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.who button { background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 7px; padding: 4px 10px; }
@media (max-width: 860px) { .brand span, .who .nm { display: none; } .top-in { gap: 6px 10px; flex-wrap: wrap; height: auto; padding: 8px 16px 6px; } .brand { flex: 1; } .nav { order: 3; flex-basis: 100%; } }

/* ---------- mise en page ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sp { flex: 1; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 16px; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; border-left: 4px solid var(--blue); cursor: pointer; }
.kpi .v { font-size: 26px; font-weight: 700; }
.kpi .l { color: var(--muted); font-size: 12.5px; }
.kpi.late { border-color: var(--late); } .kpi.warn { border-color: var(--warn); } .kpi.ok { border-color: var(--ok); }

/* ---------- éléments ---------- */
.btn { background: var(--blue); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 600; }
.btn:hover { filter: brightness(1.07); }
.btn.sec { background: #e7ecf2; color: var(--ink); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; font-weight: 600; }
.btn:disabled { opacity: .55; cursor: default; }
input, select, textarea { font: inherit; color: var(--ink); width: 100%; border: 1px solid #cdd5df; border-radius: 8px; padding: 8px 10px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc3f2; border-color: var(--blue); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters > * { width: auto; min-width: 150px; }
.filters input[type=search] { min-width: 220px; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: var(--idle-50); color: var(--idle); white-space: nowrap; }
.badge.ok { background: var(--ok-50); color: var(--ok); } .badge.late { background: var(--late-50); color: var(--late); }
.badge.warn { background: var(--warn-50); color: var(--warn); } .badge.blue { background: var(--blue-50); color: var(--blue); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 11.5px; background: #eef3f8; border-radius: 20px; padding: 2px 8px; color: #33475b; }
.chip.me { background: var(--navy); color: #fff; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.progress { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ok); }

/* ---------- listes d'activités ---------- */
.list { display: flex; flex-direction: column; }
.item { display: grid; grid-template-columns: 118px 1fr auto; gap: 12px; padding: 11px 4px; border-top: 1px solid var(--line); align-items: start; }
.item:first-child { border-top: 0; }
.item .when { font-size: 12.5px; color: var(--muted); }
.item .when b { display: block; color: var(--ink); font-size: 13px; }
.item .t { font-weight: 600; }
.item .meta { font-size: 12.5px; color: var(--muted); margin: 2px 0 5px; }
.item .side { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
@media (max-width: 640px) { .item { grid-template-columns: 1fr; } .item .side { flex-direction: row; align-items: center; } }
.sec-title { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 6px 0 4px; display: flex; gap: 8px; align-items: center; }

/* ---------- tableaux ---------- */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: #fff; background: var(--blue); padding: 8px 10px; position: sticky; top: 0; white-space: nowrap; }
th:first-child { border-top-left-radius: 8px; } th:last-child { border-top-right-radius: 8px; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:hover td { background: #f7fafd; }

/* ---------- cartes projet ---------- */
.pcard { cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: transform .08s; }
.pcard:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,24,40,.12); }
.pcard .code { font-size: 12px; font-weight: 700; color: var(--blue); }
.pcard .lib { font-weight: 700; font-size: 15px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; } }

/* ---------- planning ---------- */
.gantt { overflow-x: auto; }
.g-in { min-width: 760px; }
.g-head, .g-row { display: grid; grid-template-columns: 260px 1fr; }
.g-head .days { display: grid; }
.g-head .wk { font-size: 11.5px; color: var(--muted); padding: 6px 4px; border-left: 1px solid var(--line); }
.g-row { border-top: 1px solid var(--line); min-height: 38px; }
.g-row .lbl { padding: 7px 10px 7px 0; font-size: 12.5px; overflow: hidden; }
.g-row .lbl b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-row .track { position: relative; background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); }
.bar { position: absolute; top: 9px; height: 20px; border-radius: 6px; background: var(--blue); color: #fff; font-size: 11px; padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.bar.ok { background: var(--ok); } .bar.late { background: var(--late); } .bar.warn { background: var(--warn); } .bar.idle { background: #8aa5c4; }
.today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--late); opacity: .55; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

/* ---------- modale ---------- */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 30px 12px; }
.modal[hidden] { display: none; }
.dlg { background: #fff; border-radius: 12px; width: 100%; max-width: 760px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.dlg header { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.dlg header h2 { margin: 0; flex: 1; }
.dlg header button { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--muted); }
.dlg .body { padding: 16px 18px; }
.dlg footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.fgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.f label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.f.full { grid-column: 1 / -1; }
.picks { display: flex; flex-wrap: wrap; gap: 6px; }
.picks label { display: flex; align-items: center; gap: 5px; background: #eef3f8; padding: 4px 9px; border-radius: 20px; font-size: 12.5px; cursor: pointer; }
.picks input { width: auto; margin: 0; }
.picks label.on { background: var(--navy); color: #fff; }
.err { color: var(--late); font-weight: 600; margin-top: 10px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 60; box-shadow: var(--shadow); }

/* ---------- connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #073763 0%, #0b4d8a 60%, #0563C1 100%); }
.login .box { background: #fff; border-radius: 14px; padding: 34px 30px; width: 100%; max-width: 400px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login .logo { width: 54px; height: 54px; border-radius: 14px; background: var(--navy); color: #fff; font-weight: 700; display: grid; place-items: center; margin: 0 auto 14px; font-size: 18px; }
.login h1 { font-size: 19px; }
.login p { color: var(--muted); margin: 6px 0 22px; }
#gbtn { display: flex; justify-content: center; min-height: 44px; }
.sw { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.sw input { width: 16px; height: 16px; margin: 0; }
tr[hidden] { display: none; }
@media (max-width: 1360px) { .brand span { display: none; } }
