/* Jëff : barre latérale fixe + espace de travail ; sur mobile la barre devient un tiroir. Charte Plan IT : bleu du logo, or de l'étoile. */
@font-face { font-family: "Geist"; src: url("fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #F4F5FA; --surface: #FFFFFF; --sunk: #EEF0F7; --fg: #151935; --muted: #5E6487; --line: #E1E4F0;
  --brand: #303880; --brand-soft: #E7E9F8; --brand-ink: #FFFFFF; --gold: #F8B858; --gold-soft: #FDF0DA; --gold-ink: #7A4E08;
  --ok: #1D7F52; --ok-soft: #E2F4EB; --warn: #9A6212; --warn-soft: #FBF0DC; --bad: #B23A33; --bad-soft: #FBE7E5;
  --side: #1B2150; --side-fg: #DCE0F7; --side-dim: #8F96C4; --side-hi: #2A3172;
  --sans: "Geist", "Helvetica Neue", Arial, sans-serif; --mono: "Geist Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #0A0E22; --surface: #121734; --sunk: #0E1330; --fg: #ECEEF8; --muted: #9AA0C3; --line: #252B52;
  --brand: #8A93EC; --brand-soft: #1E2550; --brand-ink: #0A0E22; --gold: #F8B858; --gold-soft: #3A2C14; --gold-ink: #F8C878;
  --ok: #5BC48F; --ok-soft: #12301F; --warn: #E9B25A; --warn-soft: #33260F; --bad: #F08079; --bad-soft: #3A1715;
  --side: #070A1A; --side-fg: #DCE0F7; --side-dim: #7F86B4; --side-hi: #161C42; color-scheme: dark; } }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
a { color: var(--brand); }
.num, td.r, .kpi b { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted, .note { color: var(--muted); }
.note { font-size: 12.5px; }
svg.lucide { width: 16px; height: 16px; flex: none; stroke-width: 1.75; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Structure ---------- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--side); color: var(--side-fg); display: flex; flex-direction: column; gap: 18px; padding: 20px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand .mk { width: 34px; height: 34px; border-radius: 9px; display: block; flex: none; }
/* Mot-symbole « Jëff » : les deux points du tréma en or, comme les barres du symbole */
.wm .tr, .brand .wm .tr { position: relative; display: inline; font-size: inherit; color: inherit; }
.wm .tr::after { content: ""; position: absolute; left: 50%; top: .14em; width: .16em; height: .16em; margin-left: -.2em; border-radius: 50%; background: var(--gold); box-shadow: .25em 0 0 var(--gold); }
.brand b { display: block; font-size: 17px; letter-spacing: -0.02em; }
.brand span { display: block; font-size: 11px; color: var(--side-dim); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--side-dim); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-fg); text-decoration: none; }
.nav a:hover { background: var(--side-hi); }
.nav a.on { background: var(--side-hi); color: #fff; box-shadow: inset 2px 0 0 var(--gold); }
.nav .cnt { margin-left: auto; font-size: 11px; background: var(--gold); color: #1B2150; border-radius: 99px; padding: 0 7px; font-weight: 600; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding: 0 2px; }
.side-foot a, .side-foot button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-fg); text-decoration: none; background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.side-foot a:hover, .side-foot button:hover { background: var(--side-hi); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.top .crumb { font-weight: 600; min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .grow { flex: 1; }
.top .burger { display: none; flex: none; }
.busel { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 10px; font-weight: 500; min-width: 0; flex: 0 1 auto; max-width: 260px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; flex: none; }
.av { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 11px; font-weight: 600; flex: none; }
.view { padding: 24px 28px 56px; display: flex; flex-direction: column; gap: 20px; max-width: 1280px; width: 100%; }
.loading { color: var(--muted); padding: 40px 0; }

/* ---------- En-têtes, boutons ---------- */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head h1 { font-size: 24px; font-weight: 600; }
.head p { margin: 4px 0 0; color: var(--muted); }
.acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--fg); }
.btn:hover { border-color: var(--brand); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.pri { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.pri:hover { filter: brightness(1.1); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1B2150; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.ghost:hover { color: var(--fg); }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; align-self: flex-start; }
.back:hover { color: var(--brand); }
.link { color: var(--brand); font-weight: 500; text-decoration: none; }
.link:hover { text-decoration: underline; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Panneaux, tableaux ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.panel > .ph { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel > .ph h2 { font-size: 14.5px; font-weight: 600; }
.panel > .ph > span { color: var(--muted); font-size: 12.5px; }
.panel > .pb { padding: 16px 18px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 10px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--sunk); }
th.r, td.r { text-align: right; white-space: nowrap; }
td .sub { display: block; color: var(--muted); font-size: 12.5px; }
.empty { padding: 32px 18px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty b { color: var(--fg); font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi span { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kpi b { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.kpi b small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.kpi em { font-style: normal; font-size: 12px; color: var(--muted); }
.kpi.alert { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.kpi.alert b { color: var(--bad); }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 99px; white-space: nowrap; background: var(--sunk); color: var(--muted); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--brand-soft); color: var(--brand); }
.chip.gold { background: var(--gold-soft); color: var(--gold-ink); }
.tag { font-size: 11.5px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; color: var(--muted); white-space: nowrap; }
.bu { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500; border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; white-space: nowrap; color: var(--fg); background: var(--surface); }
.bu::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--muted)); flex: none; }
.bar { height: 6px; border-radius: 99px; background: var(--sunk); overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .t { flex: 1; min-width: 0; }
.li .t b { display: block; font-weight: 500; }
.li .t span { color: var(--muted); font-size: 12.5px; }
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.filterbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 14px; font-size: 13px; }
.filterbar .grow { flex: 1; }
.alertbar { display: flex; gap: 10px; align-items: center; background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 12px 14px; font-size: 13px; flex-wrap: wrap; }
.alertbar .grow { flex: 1; min-width: 0; }
.infobar { display: flex; gap: 10px; align-items: center; background: var(--brand-soft); color: var(--fg); border-radius: 10px; padding: 12px 14px; font-size: 13px; flex-wrap: wrap; }
.infobar .grow { flex: 1; min-width: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a.on { color: var(--fg); border-bottom-color: var(--gold); }
.tabs a:hover { color: var(--fg); }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 12.5px; color: var(--muted); }
.field input, .field select, .field textarea { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 10px; min-width: 0; width: 100%; }
.field textarea { min-height: 80px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--muted); }
.field input:focus, .field select:focus, .field textarea:focus, .cell:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form .wide { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; }
.cell { border: 1px solid transparent; background: var(--sunk); border-radius: 6px; padding: 6px 8px; width: 100%; min-width: 0; }
.cell.n { text-align: right; font-variant-numeric: tabular-nums; }
.totals { display: grid; grid-template-columns: max-content max-content; gap: 6px 28px; justify-content: end; padding: 16px 18px; border-top: 1px solid var(--line); margin: 0; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.totals .big { font-size: 18px; font-weight: 600; color: var(--fg); }
.err { color: var(--bad); font-size: 13px; margin: 0; }
.color-in { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.secret { display: flex; align-items: center; gap: 8px; background: var(--sunk); border-radius: 8px; padding: 10px 12px; font-family: var(--mono); font-size: 14px; word-break: break-all; }
.secret span { flex: 1; }

/* ---------- Graphique ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-family: var(--sans); font-size: 11px; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Jalons ---------- */
.steps { display: flex; flex-direction: column; }
.step { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); }
.dot.done { background: var(--ok); border-color: var(--ok); }
.dot.now { background: var(--gold); border-color: var(--gold); }

/* ---------- Cartes ---------- */
.cards3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.bcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.bcard .top2 { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.bcard h2 { font-size: 16px; font-weight: 600; }
.sw { width: 12px; height: 12px; border-radius: 3px; background: var(--c); display: inline-block; margin-right: 8px; }

/* ---------- Modale, toast ---------- */
.scrim { position: fixed; inset: 0; background: rgba(8, 11, 30, .55); display: grid; place-items: center; padding: 16px; z-index: 40; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; width: min(560px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.3); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal.wide { width: min(820px, 100%); }
.modal .mh { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal .mh h2 { font-size: 16px; font-weight: 600; flex: 1; }
.modal .mb { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal .mf { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--fg); color: var(--bg); padding: 12px 16px; border-radius: 10px; display: flex; gap: 10px; align-items: center; box-shadow: 0 8px 30px rgba(0,0,0,.2); z-index: 60; max-width: calc(100% - 40px); }
.toast.err { background: var(--bad); color: #fff; }

/* ---------- Connexion ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(60% 50% at 80% 10%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 70%), var(--bg); }
.login { width: min(400px, 100%); display: flex; flex-direction: column; gap: 22px; }
.login .brand b { color: var(--fg); }
.login .brand span { color: var(--muted); }
.login .panel { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-size: 20px; }

@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .2s; height: 100%; }
  .app.menu .side { transform: none; box-shadow: 0 0 0 100vmax rgba(5, 8, 25, .5); }
  .top .burger { display: inline-flex; }
  .top { padding: 10px 16px; }
  .view { padding: 20px 16px 48px; }
  .grid2, .form, .form.three { grid-template-columns: minmax(0, 1fr); }
  .who .nm { display: none; }
  th, td { padding: 10px 12px; }
}
@media (max-width: 480px) { .kpis { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .side { transition: none; } .spin { animation: none; } }

/* Pages de connexion : logo centré et en grand */
.login .brand { flex-direction: column; justify-content: center; text-align: center; gap: 14px; padding: 0; }
.login .brand .mk { width: 76px; height: 76px; border-radius: 19px; box-shadow: 0 10px 30px color-mix(in srgb, var(--brand) 25%, transparent); }
.login .brand b { font-size: 34px; line-height: 1.1; letter-spacing: -0.03em; }
.login .brand span { font-size: 13px; margin-top: 2px; }
.login > .note { text-align: center; margin: 0; }

/* Fond des pages de connexion : logo Plan IT en mosaïque décalée, en fondu vers le centre */
.login-wrap { position: relative; isolation: isolate; overflow: hidden; }
.login-wrap::before {
  content: ""; position: absolute; inset: -40px; z-index: -1; pointer-events: none;
  background-image: url("planit-tile.png"), url("planit-tile.png");
  background-size: 120px 120px, 120px 120px; background-repeat: repeat, repeat;
  background-position: 0 0, 60px 60px; /* deux grilles décalées = mosaïque en quinconce */
  opacity: .07; transform: rotate(-12deg) scale(1.15);
  -webkit-mask-image: radial-gradient(ellipse at center, transparent 0%, transparent 28%, #000 75%);
  mask-image: radial-gradient(ellipse at center, transparent 0%, transparent 28%, #000 75%);
}
@media (prefers-color-scheme: dark) { .login-wrap::before { background-image: url("planit-tile-light.png"), url("planit-tile-light.png"); opacity: .06; } }

/* ---------- Tableaux en colonnes (tâches, pipelines) ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 4px; align-items: start; }
.col { background: var(--sunk); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.col h3 { font-size: 11.5px; font-weight: 600; display: flex; justify-content: space-between; padding: 4px 4px 2px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.card > b { font-weight: 500; font-size: 13.5px; }
.card .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.card .meta .grow { flex: 1; }
.card .acts { gap: 6px; }
.late { color: var(--bad); }
.av.xs { width: 22px; height: 22px; font-size: 9.5px; }
.col .empty-col { font-size: 12px; color: var(--muted); padding: 8px 4px; }

/* ---------- Planning ---------- */
.gantt { overflow-x: auto; }
.gt { min-width: 860px; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.gt .lab { padding: 10px 18px; border-bottom: 1px solid var(--line); font-size: 13px; min-width: 0; }
.gt .lab span { display: block; color: var(--muted); font-size: 12px; }
.gt .lane { position: relative; border-bottom: 1px solid var(--line); min-height: 56px; }
.gt .hd { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; min-height: 38px; }
.gt .hd span { position: absolute; top: 12px; padding-left: 6px; white-space: nowrap; }
.gb { position: absolute; top: 50%; height: 14px; transform: translateY(-50%); border-radius: 99px; background: var(--brand-soft); border: 1px solid var(--c, var(--brand)); overflow: hidden; }
.gb i { display: block; height: 100%; background: var(--c, var(--brand)); }
.gm { position: absolute; top: 50%; width: 10px; height: 10px; background: var(--gold); transform: translate(-50%, -50%) rotate(45deg); outline: 2px solid var(--surface); }
.gm.done { background: var(--ok); }
.vl { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.vl.today { width: 2px; background: var(--bad); opacity: .75; }

/* ---------- Charge ---------- */
.load { display: inline-block; min-width: 64px; text-align: center; padding: 4px 8px; border-radius: 6px; font-weight: 500; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.load.ok { background: var(--ok-soft); color: var(--ok); }
.load.warn { background: var(--warn-soft); color: var(--warn); }
.load.bad { background: var(--bad-soft); color: var(--bad); }
.load.off { background: var(--sunk); color: var(--muted); }

/* ---------- Feuille de temps ---------- */
.tgrid td, .tgrid th { padding: 8px 10px; }
.tgrid input.cell { width: 58px; text-align: right; }
.tgrid .we { background: color-mix(in srgb, var(--sunk) 60%, transparent); }
.weeknav { display: flex; align-items: center; gap: 8px; }
