:root {
  /* Thème clair (par défaut) */
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-2: #eef0f3;
  --border: #e3e5ea;
  --text: #1a1c22;
  --muted: #696d78;
  --red: #e11d2a;
  --red-soft: #b3151f;
  --red-dim: rgba(225, 29, 42, 0.09);
  --ok: #1f9d4d;
  --warn: #b07d00;
  --accent: #2f6fed;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-lg: 0 14px 36px rgba(16, 24, 40, .13);
  --sidebar-bg: #ffffff;
}
[data-theme="dark"] {
  --bg: #0c0c0d;
  --panel: #161617;
  --panel-2: #1f1f21;
  --border: #2c2c2f;
  --text: #f2f2f4;
  --muted: #8d8d94;
  --red: #e11d2a;
  --red-soft: #b3151f;
  --red-dim: rgba(225, 29, 42, 0.15);
  --ok: #3fb950;
  --warn: #e0a800;
  --accent: #4f9cf9;
  --shadow: none;
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
  --sidebar-bg: linear-gradient(180deg, #121214 0%, #0d0d0f 100%);
}
* { box-sizing: border-box; }
body {
  margin: 0; display: flex; min-height: 100dvh;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text);
  transition: background-color .2s ease, color .2s ease;
}

/* ============================================================
   Layout ERP — sidebar + content-wrap + subnav contextuel
   ============================================================ */
body { display: flex; }
.content-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 100dvh; }

/* --- Sub-nav contextuel ---- */
.subnav {
  display: flex; align-items: center; gap: 3px;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 2px solid var(--sc, var(--border));
  flex-shrink: 0; overflow-x: auto; min-height: 50px;
  transition: border-color .2s;
}
/* Pill section — pastille colorée + label */
.sv-head {
  display: flex; align-items: center; gap: 6px; margin-right: 6px; flex-shrink: 0;
  background: var(--sc, var(--red));
  border-radius: 999px; padding: 5px 12px 5px 9px;
}
.sv-head svg { width: 14px; height: 14px; color: #fff; flex-shrink: 0; }
.sv-section-lbl {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px;
  color: #fff; white-space: nowrap;
}
.sv-divider {
  width: 1px; height: 20px; background: var(--border);
  margin: 0 8px; flex-shrink: 0;
}
/* Tabs pillules */
.sv-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 8px; border: none;
  cursor: pointer; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500;
  background: transparent; transition: all .14s; white-space: nowrap;
}
.sv-btn:hover { background: var(--panel-2); color: var(--text); }
.sv-btn.active {
  background: var(--panel-2);
  color: var(--text);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--sc, var(--red));
}
.sv-btn .badge {
  display: inline-block; font-size: 10px;
  background: var(--red); color: #fff;
  border-radius: 999px; padding: 0 5px; min-width: 16px; text-align: center;
}

/* --- Sidebar — 6 sections avec icônes orbes --- */
.sidebar {
  width: 215px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 16px 10px 20px; flex-shrink: 0;
  height: 100dvh; position: sticky; top: 0; overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; padding: 2px 4px; }
.logobox { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; display: inline-flex; align-items: center; }
.logobox img { height: 24px; width: auto; display: block; }

#mainnav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.snav-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 6px 8px 6px 6px; border-radius: 12px;
  cursor: pointer; background: none; border: 1px solid transparent;
  font: inherit; font-size: 13px; font-weight: 500;
  color: var(--muted); text-align: left;
  transition: all .15s; position: relative;
}
.snav-btn:hover { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.snav-btn:hover .snav-icon { border-color: var(--sc); color: var(--sc); }
.snav-btn.active {
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--border);
}
/* Trait coloré gauche sur la section active */
.snav-btn.active::before {
  content: ''; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 65%; border-radius: 0 3px 3px 0;
  background: var(--sc);
  box-shadow: 2px 0 10px -1px var(--sc);
}
.snav-btn.active .snav-icon {
  background: var(--sc);
  border-color: var(--sc);
  color: #fff;
  box-shadow: 0 0 20px -5px var(--sc);
}
/* Orbe icône */
.snav-icon {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--muted); transition: all .2s;
}
.snav-icon svg { width: 19px; height: 19px; }
.snav-label { line-height: 1; letter-spacing: -.1px; }
/* Badge section */
.snav-badge { font-size: 10px; background: var(--red); color: #fff; border-radius: 999px; padding: 1px 6px; margin-left: auto; }

main { flex: 1; padding: 24px 28px; overflow: auto; }
h2 { letter-spacing: -.3px; margin-top: 0; }

/* Toasts */
#toasts { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px;
  padding: 11px 16px; box-shadow: var(--shadow-lg); min-width: 220px; max-width: 360px; animation: toastin .25s ease; }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--red); }
@keyframes toastin { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* Dépannage / KB */
details.kbvend { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 4px 14px; margin-bottom: 8px; }
details.kbvend > summary { cursor: pointer; padding: 8px 0; list-style: none; }
details.kbvend > summary::-webkit-details-marker { display: none; }
details.kbvend > summary::before {
  content: ""; display: inline-block; width: 13px; height: 13px; margin-right: 8px; vertical-align: -2px;
  background: var(--muted); transform: rotate(-90deg);
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7.5 10 12.5 15 7.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
details.kbvend[open] > summary::before { transform: rotate(0deg); }
details.kbvend[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 6px; }
details.kbvend[data-empty] > summary { opacity: .55; }
details.kbmod { margin: 8px 0 4px; }
details.kbmod > summary { cursor: pointer; list-style: none; padding: 4px 0; }
details.kbmod > summary::-webkit-details-marker { display: none; }
details.kbmod > summary::before {
  content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 6px; vertical-align: -1px;
  background: var(--muted); transform: rotate(-90deg);
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7.5 10 12.5 15 7.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
details.kbmod[open] > summary::before { transform: rotate(0deg); }
.kbgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin: 8px 0 6px; }
.kbcardd { background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--red); border-radius: 9px; padding: 11px 13px; cursor: pointer; transition: transform .12s, border-color .12s; display: flex; flex-direction: column; justify-content: space-between; min-height: 74px; }
.kbcardd:hover { transform: translateY(-2px); border-color: var(--red); }
.kbcardd-t { font-size: 13px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.kbcardd-f { margin-top: 8px; }
.kbtag { font-size: 10px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.kbtag.pub { color: var(--accent); border-color: var(--accent); }
.kbtag.priv { color: var(--ok); border-color: var(--ok); }

/* Chatbot flottant */
.cb-src { margin-top: 8px; font-size: 12px; }
.cb-src a { color: var(--accent); }

/* ---------- Centre Agentique IA ---------- */
.aghero h2 { display: flex; align-items: center; gap: 10px; }
.aghero .agbot { filter: drop-shadow(0 0 8px rgba(79,156,249,.6)); animation: agfloat 3s ease-in-out infinite; }
@keyframes agfloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.agnote { margin: 14px 0 4px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--panel)); border-radius: 10px; padding: 12px 16px; }
.agnote-h { font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.agnote ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.agnote li { font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.agnote li b { color: var(--text); font-weight: 600; }
.agpick { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 18px 0 6px; }
.agcard { position: relative; overflow: hidden; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 7px;
  background: radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--ag) 12%, transparent) 0%, transparent 55%), var(--panel);
  border: 1px solid var(--border); border-radius: 16px; padding: 18px 18px 16px; color: var(--text);
  transition: transform .15s, border-color .15s, box-shadow .15s; }
.agcard::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--ag); opacity: .55; }
.agcard:hover { transform: translateY(-4px); border-color: var(--ag); box-shadow: 0 14px 36px rgba(0,0,0,.45), 0 0 0 1px color-mix(in srgb, var(--ag) 40%, transparent); }
.agcard.on { border-color: var(--ag); box-shadow: 0 0 0 1px var(--ag), 0 0 34px -6px color-mix(in srgb, var(--ag) 70%, transparent); }
.agcard.on::before { opacity: 1; }
.agorb { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 24px;
  background: color-mix(in srgb, var(--ag) 18%, var(--panel-2)); border: 1px solid color-mix(in srgb, var(--ag) 45%, transparent);
  box-shadow: 0 0 22px -6px var(--ag); }
.agtag { font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--ag); }
.agname { font-size: 16px; font-weight: 700; }
.agdesc { font-size: 12.5px; color: var(--muted); line-height: 1.5; flex: 1; }
.agcta { font-size: 11px; font-weight: 700; color: var(--ag); margin-top: 4px; letter-spacing: .3px; }

.agshell { margin-top: 16px; border: 1px solid color-mix(in srgb, var(--ag) 45%, var(--border)); border-radius: 16px;
  background: var(--panel); overflow: hidden; box-shadow: 0 0 30px -10px color-mix(in srgb, var(--ag) 60%, transparent); display: flex; flex-direction: column; }
.agbar { display: flex; gap: 8px; align-items: center; padding: 11px 13px; border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, color-mix(in srgb, var(--ag) 10%, transparent), transparent); }
.agpill { font-size: 12.5px; font-weight: 700; padding: 4px 11px; border-radius: 999px; white-space: nowrap;
  color: var(--ag); border: 1px solid color-mix(in srgb, var(--ag) 55%, transparent); background: color-mix(in srgb, var(--ag) 12%, transparent); }
.agbar select { font-size: 12px; padding: 6px 8px; max-width: 220px; }
.aglog { min-height: 240px; max-height: 52vh; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.aglog .msg { max-width: 88%; font-size: 13.5px; }
.agwelcome { margin: auto; text-align: center; max-width: 440px; padding: 18px; }
.agwelcome .agwo { font-size: 40px; filter: drop-shadow(0 0 14px color-mix(in srgb, var(--ag) 80%, transparent)); }
.agwelcome p { margin: 6px 0; font-size: 13.5px; }
.aginput { display: flex; gap: 9px; align-items: flex-end; padding: 12px 13px; border-top: 1px solid var(--border); background: var(--panel-2); }
.aginput textarea { flex: 1; resize: none; min-height: 40px; max-height: 140px; line-height: 1.4; font-family: inherit; }
.aginput textarea:focus { border-color: var(--ag); outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--ag) 30%, transparent); }
.agsend { flex-shrink: 0; width: 40px; height: 40px; border-radius: 11px; border: none; cursor: pointer; font-size: 16px; color: #0c0c0d; font-weight: 700;
  background: var(--ag); box-shadow: 0 4px 16px -4px var(--ag); transition: transform .1s; }
.agsend:hover { transform: scale(1.06); }
.agtyping { display: inline-flex; gap: 4px; }
.agtyping i { width: 7px; height: 7px; border-radius: 50%; background: var(--ag); opacity: .5; animation: agblink 1s infinite; }
.agtyping i:nth-child(2) { animation-delay: .2s; } .agtyping i:nth-child(3) { animation-delay: .4s; }
@keyframes agblink { 0%,100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
.kbtools { margin-top: 6px; }
.kbpanel { display: flex; flex-direction: column; }
.kbpanel-ai { border-color: rgba(225,29,42,.4); }
.kbphead { font-weight: 700; font-size: 15px; }
.kbscope { display: flex; gap: 8px; margin-top: 4px; }
.kbscope select { flex: 1; }
.kbsearchbar { display: flex; gap: 8px; margin-top: 8px; }
.kbsearchbar input { flex: 1; }
.kbpane { margin-top: 6px; }
.kbrow { margin: 6px 0; line-height: 1.7; }
.kblink { color: var(--accent); text-decoration: none; }
.kblink:hover { text-decoration: underline; }
.kbres { padding: 10px; border: 1px solid var(--border); border-radius: 8px; margin-top: 8px; cursor: pointer; }
.kbres:hover { border-color: var(--red); }
.kbbody { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; line-height: 1.7; font-size: 14px; max-height: 50vh; overflow-y: auto; }
.kbbody code { background: var(--panel-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; }

/* Login */
.loginwrap { display: flex; align-items: center; justify-content: center; min-height: 80dvh; }
.logincard { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 30px 28px; width: 340px; box-shadow: var(--shadow-lg); }

/* Chip utilisateur + badge nav */
#userchip { margin-top: 18px; padding: 12px; border-top: 1px solid var(--border); }
.uc-name { font-size: 13px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: none; color: var(--text); cursor: pointer; padding: 4px 2px; border-radius: 6px; text-align: left; font-family: inherit; }
.uc-name:hover { background: var(--panel-2); }
.uc-gear { margin-left: auto; color: var(--muted); }
.uc-admin { color: var(--red); font-size: 10px; text-transform: uppercase; letter-spacing: .5px; border: 1px solid var(--red); border-radius: 4px; padding: 0 4px; }
#userchip .btn { width: 100%; }
.uc-top { display: flex; align-items: center; gap: 8px; }
.uc-top .uc-name { flex: 1; margin-bottom: 0; }
.uc-theme { flex-shrink: 0; width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  font-size: 14px; line-height: 1; display: grid; place-items: center; padding: 0; transition: border-color .15s; }
.uc-theme:hover { border-color: var(--red); }
#userchip { margin-top: auto; }
nav button { position: relative; }
nav button .badge { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: var(--red); color: #fff; font-size: 10px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }
h2 { margin: 0 0 4px; }
h2 .accent { color: var(--red); }
.muted { color: var(--muted); }
.row { display: flex; gap: 14px; flex-wrap: wrap; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; min-width: 140px; position: relative; overflow: hidden;
  box-shadow: var(--shadow);
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--red); }
.card .n { font-size: 30px; font-weight: 700; }
.card .l { color: var(--muted); font-size: 13px; }
.card { transition: transform .12s, border-color .12s; }
.card[data-go]:hover { transform: translateY(-2px); border-color: var(--red); }
.card.danger::before { background: var(--red); } .card.danger .n { color: var(--red); }
.card.warn::before { background: var(--warn); } .card.warn .n { color: var(--warn); }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td { background: var(--panel-2); }

table { width: 100%; border-collapse: collapse; margin-top: 14px; background: var(--panel); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tfoot td { border-top: 2px solid var(--border); border-bottom: none; }
tr:last-child td { border-bottom: none; }

input, select, textarea {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 7px 9px; font: inherit; width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--red); }
.combo { position: relative; display: inline-flex; align-items: stretch; width: 100%; min-width: 150px; }
.toolbar .combo { width: auto; }
.combo-q { padding-right: 34px; }
.combo-q:focus { outline: none; border-color: var(--red); }
.combo-btn {
  position: absolute; right: 1px; top: 1px; bottom: 1px; width: 32px; border: 0; border-left: 1px solid var(--border);
  border-radius: 0 7px 7px 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0;
  display: grid; place-items: center;
}
.combo-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.combo-btn:hover { color: var(--text); background: rgba(255,255,255,.04); }
.combo-menu {
  position: absolute; z-index: 50; top: calc(100% + 4px); left: 0; right: 0; max-height: 260px; overflow-y: auto;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0,0,0,.16); padding: 4px;
}
.combo-opt {
  display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text);
  padding: 8px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font: inherit;
}
.combo-opt:hover, .combo-opt:focus { background: rgba(225,29,42,.10); outline: none; }
.combo-empty { color: var(--muted); font-size: 12px; padding: 8px 10px; }
.combo-opt.combo-create { color: var(--accent); font-weight: 600; border-top: 1px solid var(--border); }
button.btn { background: var(--red); color: #fff; border: none; border-radius: 7px; padding: 8px 14px; cursor: pointer; font: inherit; }
button.btn:hover { background: var(--red-soft); }
button.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
button.btn.ok   { background: var(--ok); color: #0c0c0d; }
button.btn.err  { background: var(--red); color: #fff; }
button.btn.ghost.ok  { background: rgba(63,185,80,.12); color: var(--ok); border-color: var(--ok); }
button.btn.ghost.err { background: rgba(225,29,42,.12); color: var(--red); border-color: var(--red); }
/* Polices de la charte S&M, utilisées par la fiche de projet. Elles sont déclarées ici, au niveau
   du document, et pas seulement dans la feuille de la fiche : l'aperçu est monté dans un shadow
   root, et les navigateurs ignorent les @font-face déclarées à l'intérieur d'un shadow root. */
@font-face { font-family: "PT Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/pt-serif-400.woff2) format("woff2"); }
@font-face { font-family: "PT Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/pt-serif-400i.woff2) format("woff2"); }
@font-face { font-family: "PT Serif"; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/pt-serif-700.woff2) format("woff2"); }
@font-face { font-family: "PT Sans";  font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/pt-sans-400.woff2) format("woff2"); }
@font-face { font-family: "PT Sans";  font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/pt-sans-700.woff2) format("woff2"); }

/* Fiche de projet : les actions « ouvrir » et « télécharger » sont des liens (pas de JS), et
   doivent donc porter le même habillage que les boutons de la barre d'outils. */
a.btn { display: inline-block; background: var(--red); color: #fff; border: none; border-radius: 7px; padding: 8px 14px; cursor: pointer; font: inherit; text-decoration: none; }
a.btn:hover { background: var(--red-soft); }
a.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
/* Solution sans modèle de planning : l'écran le dit et propose d'y remédier. */
.tpl-vide { border: 1px dashed var(--border); border-left: 3px solid var(--red); border-radius: 8px;
  padding: 14px 18px; margin: 14px 0; background: var(--panel-2); }
.tpl-vide p { margin: 0 0 8px; font-size: 13.5px; }
.tpl-vide p:last-of-type { margin-bottom: 0; }

/* Barre d'actions groupées des notes de frais : n'apparaît qu'avec une sélection. */
.exp-bulk { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 0;
  padding: 10px 14px; border: 1px solid var(--border); border-left: 3px solid var(--red);
  border-radius: 8px; background: var(--panel-2); }
.exp-bulk-n { font-weight: 600; font-size: 13px; }
.exp-bulk .btn[disabled] { opacity: .45; cursor: not-allowed; }

/* Contrôle de complétude de la fiche : visible dans TeamOps uniquement, jamais dans le document. */
.fiche-gaps { border: 1px dashed var(--red); border-radius: 8px; padding: 12px 16px; margin: 14px 0 0; background: rgba(225, 29, 42, .05); }
.fiche-gaps h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--red); }
.fiche-gaps ul { margin: 0; padding-left: 18px; columns: 2; column-gap: 24px; font-size: 13px; color: var(--text); }
.fiche-gaps li { margin-bottom: 4px; break-inside: avoid; }
.fiche-complete { color: var(--ok); font-size: 13px; margin: 14px 0 0; }
@media (max-width: 700px) { .fiche-gaps ul { columns: 1; } }

.seg-toggle { display: inline-flex; gap: 0; }
.seg-toggle .btn { border-radius: 0; }
.seg-toggle .btn:first-child { border-radius: 7px 0 0 7px; }
.seg-toggle .btn:last-child { border-radius: 0 7px 7px 0; }
.seg-toggle button.btn.ghost.active { background: var(--red); color: #fff; border-color: var(--red); }

button.icon { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 15px; }
button.icon:hover { color: var(--text); }
/* Icônes SVG inline (remplacent les emojis) : suivent la taille et la couleur du texte. */
.ic { width: 1em; height: 1em; vertical-align: -0.125em; flex: 0 0 auto; display: inline-block; }
.ic-red { color: var(--red); }
.toolbar { display: flex; gap: 10px; margin: 16px 0; align-items: center; flex-wrap: wrap; }

.pill { padding: 2px 9px; border-radius: 999px; font-size: 12px; background: var(--panel-2); white-space: nowrap; }
.pill.en_cours { color: var(--red); background: var(--red-dim); }
.pill.termine, .pill.done { color: var(--ok); }
.pill.todo { color: var(--muted); }
.pill.doing { color: var(--warn); }
.pill.blocked { color: var(--red); }
.pill.warn, .pill.pending { color: var(--warn); }
.pill.ok, .pill.approved { color: var(--ok); }
.pill.err, .pill.rejected { color: var(--red); }
.pill.muted, .pill.cancelled { color: var(--muted); }

.chip { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12px; background: var(--panel-2); border: 1px solid var(--border); margin: 2px 4px 2px 0; }
.chip .lead { color: var(--red); font-weight: 600; }

.bar { height: 18px; background: var(--panel-2); border-radius: 5px; overflow: hidden; min-width: 120px; }
.bar > span { display: block; height: 100%; background: var(--red); }
.bar > span.over { background: #ff3b46; }

/* Matrice */
.matrix td { text-align: center; cursor: pointer; user-select: none; }
.matrix td.lvl { font-weight: 600; }
.lvl0 { color: var(--border); } .lvl1 { color: var(--muted); } .lvl2 { color: #ff8088; }
.lvl3 { color: #ff4d57; } .lvl4 { color: var(--red); }
.cert::after { content: " ★"; color: var(--warn); }

/* Solutions */
.sol-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 14px; }
.sol-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sol-head .cat { color: var(--muted); font-size: 12px; }

/* Calendrier */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; margin-top: 14px;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--panel); box-shadow: var(--shadow); }
.cal-dow { color: var(--muted); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  text-align: left; padding: 8px 10px; background: var(--panel-2); border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
.cal-cell { background: var(--panel); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  min-height: 98px; min-width: 0; padding: 5px 7px 7px; cursor: pointer; transition: background .12s; }
.cal-cell:hover { background: var(--panel-2); }
.cal-cell.week { min-height: 240px; }
.cal-cell.muted-cell { background: var(--bg); }
.cal-cell.muted-cell .cal-num { opacity: .4; }
.cal-cell.today { background: var(--red-dim); }
.cal-num { font-size: 12px; color: var(--muted); margin-bottom: 5px; display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; }
.cal-cell.today .cal-num { background: var(--red); color: #fff; border-radius: 50%; font-weight: 700; }
.ev { font-size: 11px; padding: 3px 7px; border-radius: 5px; margin-bottom: 3px; font-weight: 500; background: var(--red-dim); border-left: 3px solid var(--red); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.ev:hover { filter: brightness(1.06); }
.ev.workshop { background: rgba(224,168,0,.15); border-left-color: var(--warn); }
.ev.formation { background: rgba(63,185,80,.15); border-left-color: var(--ok); }
.ev.reunion { background: rgba(120,120,200,.18); border-left-color: #8a8ae0; }
.ev.conge { background: var(--panel-2); border-left-color: var(--muted); color: var(--text); }
.ev.deplacement { background: rgba(0,170,200,.15); border-left-color: #28b6d6; }
.ev.externe { background: rgba(150,120,230,.16); border-left-color: #9a7be6; }
.ev.session { background: rgba(225,29,42,.18); border-left-color: var(--red); font-weight: 600; }
.ev.echeance { background: rgba(224,168,0,.16); border-left-color: var(--warn); }

/* Calendrier mobile : grille compacte à pastilles + agenda du jour sélectionné */
.cal-mini .cal-dow { text-align: center; padding: 5px 0; }
.cal-mcell { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 44px; min-width: 0;
  padding: 5px 2px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); cursor: pointer; }
.cal-mcell.muted-cell { opacity: .42; }
.cal-mcell.sel { background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--accent); }
.cal-mn { font-size: 12.5px; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; color: var(--text); }
.cal-mcell.today .cal-mn { background: var(--red); color: #fff; border-radius: 50%; font-weight: 700; }
.cal-dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; min-height: 6px; max-width: 100%; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--red); }
.cal-dot.workshop, .cal-dot.echeance { background: var(--warn); }
.cal-dot.formation { background: var(--ok); }
.cal-dot.reunion { background: #8a8ae0; }
.cal-dot.conge { background: var(--muted); }
.cal-dot.deplacement { background: #28b6d6; }
.cal-dot.externe { background: #9a7be6; }
.cal-agenda { margin-top: 16px; }
.cal-ag-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.cal-ag-ev { padding: 11px 13px; border-radius: 9px; background: var(--panel); border: 1px solid var(--border);
  border-left: 3px solid var(--red); margin-bottom: 7px; cursor: pointer; font-size: 14px; }
.cal-ag-ev.workshop, .cal-ag-ev.echeance { border-left-color: var(--warn); }
.cal-ag-ev.formation { border-left-color: var(--ok); }
.cal-ag-ev.reunion { border-left-color: #8a8ae0; }
.cal-ag-ev.conge { border-left-color: var(--muted); }
.cal-ag-ev.deplacement { border-left-color: #28b6d6; }
.cal-ag-ev.externe { border-left-color: #9a7be6; }
.cal-ag-ev.session { border-left-color: var(--red); font-weight: 600; }

/* ---------- Calendrier vue semaine : grille horaire ---------- */
.wk { margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--panel); }
.wk-row { display: grid; grid-template-columns: 58px repeat(7, 1fr); }
.wk-head { border-bottom: 1px solid var(--border); }
.wk-dh { text-align: center; padding: 8px 4px; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 1px; }
.wk-dh span { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.wk-dh b { font-size: 17px; }
.wk-dh.today b { background: var(--red); color: #fff; border-radius: 50%; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; margin: 1px auto 0; }
/* Ligne d'heure courante (vue semaine) — repère Notion */
.wk-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 4; pointer-events: none; }
.wk-now::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.wk-gut { font-size: 10px; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.wk-allday { border-bottom: 1px solid var(--border); min-height: 34px; background: var(--panel-2); }
.wk-allday .wk-gut { text-transform: uppercase; letter-spacing: .5px; }
.wk-ad { border-left: 1px solid var(--border); padding: 4px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-height: 26px; }
.wk-ad .ev { white-space: normal; }
.wk-body { display: grid; grid-template-columns: 58px repeat(7, 1fr); max-height: 64vh; overflow-y: auto; position: relative; }
.wk-times { position: relative; flex-direction: column; display: block; }
.wk-t { height: var(--hpx); position: relative; }
.wk-t span { position: absolute; top: -7px; right: 6px; font-size: 10px; color: var(--muted); background: var(--panel); padding: 0 2px; }
.wk-col { position: relative; border-left: 1px solid var(--border); }
.wk-col.today { background: rgba(225,29,42,.04); }
.wk-slot { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); cursor: pointer; }
.wk-slot:hover { background: var(--red-dim); }
.ev.wkev { position: absolute; left: 3px; right: 3px; margin: 0; white-space: normal; line-height: 1.25; font-size: 10.5px; padding: 3px 5px; z-index: 1; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.ev.wkev b { display: block; font-size: 10px; opacity: .85; }

/* Agenda de temps horaire (pointage direct + redimensionnement) — vue Temps, réutilise la grille .wk */
.tev { position: absolute; left: 3px; right: 3px; margin: 0; overflow: hidden; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 3px 6px 4px; font-size: 10.5px; line-height: 1.25; cursor: pointer; z-index: 1; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.tev:hover { border-color: var(--red); }
.tev.running { border-left-color: var(--red); background: var(--red-dim); animation: pulse 1.6s infinite; }
.tev-t { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tev-dur { display: block; color: var(--muted); font-size: 9.5px; }
.tev-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; }
.tev-resize::after { content: ''; position: absolute; left: 50%; bottom: 2px; width: 22px; height: 3px; margin-left: -11px; border-radius: 2px; background: var(--muted); opacity: .5; }
.tev:hover .tev-resize::after { opacity: .9; background: var(--red); }

/* Kanban */
.kboard { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; align-items: start; }
.kcol { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px; min-height: 120px; }
.kcol.over { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.khead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.kbody { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.kcard { background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--muted); border-radius: 8px; padding: 9px 11px; cursor: grab; }
.kcard:active { cursor: grabbing; }
.kcard.prio-haute { border-left-color: var(--warn); }
.kcard.prio-critique { border-left-color: var(--red); }
.kcard .ktitle { font-weight: 600; margin-bottom: 5px; overflow-wrap: anywhere; }
.kcard { min-width: 0; }
.kcard .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.kcard .kmeta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.kcard .chip { margin: 2px 0 0; }
/* Sélecteur de déplacement tactile — masqué sur desktop (drag&drop), visible en mobile */
.kmove { display: none; }
.kmove input[type="text"] { width: 100%; box-sizing: border-box; }

/* Planificateur hebdo */
.pboard { display: grid; grid-template-columns: 210px repeat(7, minmax(120px, 1fr)); gap: 10px; margin-top: 14px; align-items: start; overflow-x: auto; padding-bottom: 6px; }
.pboard .kcol { min-height: 160px; }
.pbacklog { background: var(--panel-2); }
.kcol.today { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.kcol.holiday { background: repeating-linear-gradient(135deg, var(--panel), var(--panel) 8px, var(--panel-2) 8px, var(--panel-2) 16px); opacity: .85; }

/* Gantt projet */
.gantt { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.grow { display: grid; grid-template-columns: 160px 1fr; align-items: center; gap: 10px; }
.glabel { font-size: 13px; color: var(--text); }
.gtrack { position: relative; height: 22px; background: var(--panel-2); border-radius: 6px; }
.gbar { position: absolute; top: 3px; bottom: 3px; background: var(--red); border-radius: 5px; min-width: 6px; opacity: .85; }

/* Brief équipe */
.briefbox { white-space: pre-wrap; font: inherit; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin: 10px 0 0; line-height: 1.6; }

/* Suivi du temps */
#timerbar { position: fixed; bottom: 18px; left: 18px; z-index: 50; display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--red); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow-lg); }
#timerbar .tname { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#timerbar .tclock { font-variant-numeric: tabular-nums; font-size: 16px; color: var(--red); }
.tdot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.kcard { position: relative; }
.ktimer { position: absolute; top: 6px; right: 6px; background: var(--panel); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; width: 24px; height: 24px; cursor: pointer; font-size: 11px; line-height: 1; }
.ktimer:hover { border-color: var(--red); color: var(--red); }
.kcard.running { border-left-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.kcard .ktitle { padding-right: 26px; }

/* Assistant chat */
.chatlog { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.msg { max-width: 80%; padding: 10px 13px; border-radius: 12px; line-height: 1.5; }
.msg.user { align-self: flex-end; background: var(--red); color: #fff; border-bottom-right-radius: 3px; }
.msg.bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--border); border-bottom-left-radius: 3px; }
.msg.bot.warn { border-color: var(--warn); }
.msg .acts { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.msg .act { font-size: 12px; color: var(--ok); }
.chatbar { display: flex; gap: 10px; }
.chatbar input { flex: 1; }

/* Modal */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 14px; padding: 22px; width: 430px; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h3 { margin-top: 0; }
.field { margin-bottom: 12px; }
.field label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ---------- Notes de frais & Congés — KPIs ---------- */
.exp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); gap: 12px; margin: 14px 0 0; }
.exp-kpi  { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; box-shadow: var(--shadow); }
.exp-kpi .n { font-size: 26px; font-weight: 800; }
.exp-kpi .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.exp-kpi.ok   { border-color: rgba(63,185,80,.4); }
.exp-kpi.ok .n{ color: var(--ok); }
.exp-kpi.warn { border-color: rgba(224,168,0,.4); }
.exp-kpi.warn .n { color: var(--warn); }

/* ---------- Planning hebdo congés ---------- */
.lv-absent { margin: 12px 0 0; font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lv-who { padding: 2px 10px; border-radius: 999px; border: 1px solid; font-size: 12px; }
.lv-week { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.lv-week-h { font-size: 13px; margin-bottom: 10px; color: var(--muted); }
.lv-grid { display: grid; grid-template-columns: 80px repeat(7,1fr); gap: 3px; }
.lv-dh { text-align: center; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 4px 2px; }
.lv-dh.today { color: var(--red); font-weight: 700; }
.lv-dh small { display: block; font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: 0; text-transform: none; }
.lv-name { font-size: 12px; display: flex; align-items: center; padding: 2px 4px; color: var(--muted); }
.lv-cell { border-radius: 4px; height: 28px; border: 1px solid transparent; font-size: 10px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.lv-cell.on { color: var(--text); font-weight: 600; font-size: 9px; letter-spacing: .5px; text-transform: uppercase; }

/* ============================================================
   RBAC — Gestion des comptes & accès
   ============================================================ */
/* Section admin dans la sidebar — séparateur visuel */
.snav-admin { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }

/* Cards */
.rbac-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.rbac-card-h { font-weight: 700; font-size: 14px; margin-bottom: 14px; color: var(--text); }
.rbac-info-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.rbac-info-row:last-child { border-bottom: none; }

/* Matrice des rôles */
.rbac-matrix-info { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.rbac-role-card { display: flex; align-items: center; gap: 9px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; font-size: 12.5px; }

/* Role badge */
.role-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; border: 1px solid; font-size: 11.5px; font-weight: 700; white-space: nowrap; }

/* Permission badges */
.rbac-perms-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.perm-badge { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 11px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.perm-badge.admin { background: rgba(225,29,42,.12); border-color: var(--red); color: var(--red); font-weight: 700; }

/* Alerte must-change-password */
.rbac-alert { background: rgba(224,168,0,.12); border: 1px solid var(--warn); border-left: 3px solid var(--warn); border-radius: 10px; padding: 12px 16px; font-size: 13px; color: var(--warn); margin-top: 14px; }

/* Tableau RBAC */
.rbac-table { width: 100%; margin-top: 10px; }
.rbac-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.rbac-table td { padding: 10px 10px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.rbac-table tr:last-child td { border-bottom: none; }
.rbac-table tr:hover td { background: var(--panel-2); }
.rbac-disabled td { opacity: .5; }
.rbac-disabled td:first-child { opacity: 1; }

/* Checkboxes : ne pas hériter du width:100% des inputs */
input[type="checkbox"] { width: auto; }

/* Toggle admin (modale compte) */
.adm-toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); margin: 4px 0 12px; }
.adm-toggle input { display: none; }
.adm-switch { position: relative; width: 38px; height: 21px; flex: 0 0 38px; border-radius: 999px; background: var(--border); transition: background .15s; }
.adm-switch::after { content: ''; position: absolute; top: 2.5px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: all .15s; }
.adm-toggle input:checked + .adm-switch { background: var(--red); }
.adm-toggle input:checked + .adm-switch::after { left: 19px; background: #fff; }
.adm-text { font-size: 13px; line-height: 1.35; }
.adm-text small { font-size: 11.5px; }

/* Vue projets en cartes */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-top: 4px; }
.proj-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; box-shadow: var(--shadow); }
.pc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.pc-title { display: flex; flex-direction: column; }
.pc-title .cat { font-size: 11.5px; color: var(--muted); }
.pc-sub { font-size: 12.5px; }
.pc-mods { display: flex; flex-wrap: wrap; gap: 5px; }
.pc-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.pc-actions .btn { padding: 5px 10px; font-size: 12.5px; }
.pc-advisory { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 30%, var(--border)); border-radius: 8px; padding: 5px 9px; }
.pc-advisory svg { width: 14px; height: 14px; flex-shrink: 0; }
/* Tâche enrichie (Trello) : checklist + pièces jointes */
.cl-list { display: flex; flex-direction: column; gap: 2px; }
.cl-item { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13px; }
.cl-item label { display: flex; align-items: center; flex: 1; cursor: pointer; }
.cl-item label:has(input:checked) { text-decoration: line-through; color: var(--muted); }
.att-list { display: flex; flex-direction: column; gap: 4px; }
.att-item { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.att-item a { color: var(--accent); display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.att-item a:hover { text-decoration: underline; }
.att-item svg, .kbadge svg { width: 13px; height: 13px; }
.kbadge { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); background: var(--panel-2); border-radius: 6px; padding: 1px 6px; margin-top: 3px; }
.kbadge.full { color: var(--ok); }

/* Progression des phases */
.pc-phases { display: flex; flex-direction: column; gap: 5px; }
/* Carte projet compacte */
.pc-compact { gap: 8px; }
.pc-link { cursor: pointer; }
.pc-link:hover strong { color: var(--accent); }
.pcc-prog { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.pcc-lbl { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pcc-time { margin-top: 2px; }
.pcc-bar { flex: 1; height: 7px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.pcc-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .25s; }
.pcc-fill.full { background: var(--ok); }
.pc-badge.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.pc-badge.done svg { width: 11px; height: 11px; vertical-align: -1px; }
/* Page détail projet */
.pd-hero { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--panel)), var(--panel)); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; margin-bottom: 14px; }
.pd-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pd-title h2 { margin: 0; }
.pd-meta { font-size: 13px; margin-top: 4px; }
.pd-meta svg { width: 13px; height: 13px; vertical-align: -2px; }
.pd-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.pd-kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.pdk-v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pdk-l { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.pd-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.pd-tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 9px 16px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-radius: 8px 8px 0 0; }
.pd-tab:hover { color: var(--text); background: var(--panel-2); }
.pd-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.pd-section { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.pd-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pd-sec-head h3 { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 15px; }
.pd-sec-head h3 svg { width: 15px; height: 15px; color: var(--accent); }
.pd-margin { display: flex; align-items: baseline; gap: 10px; margin-top: 14px; padding: 12px 16px; border-radius: 10px; }
.pd-margin.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.pd-margin.bad { background: color-mix(in srgb, var(--red) 12%, transparent); }
.pdm-v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pd-margin.ok .pdm-v { color: var(--ok); }
.pd-margin.bad .pdm-v { color: var(--red); }
.pdm-l { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; }
.pd-margin.ok .pdm-l { color: var(--ok); }
.pd-margin.bad .pdm-l { color: var(--red); }
.pdm-l svg { width: 15px; height: 15px; }
.pd-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.pd-acts .btn { padding: 5px 10px; font-size: 12.5px; }
.pd-phases { margin-top: 10px; }
/* Onglet Temps — graphes */
.pd-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .pd-2col { grid-template-columns: 1fr; } }
.tdonut { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.tdonut-c { color: var(--text); flex-shrink: 0; }
.tlegend { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.tleg-row { display: flex; align-items: center; gap: 7px; }
.tleg-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.tchart-mod { margin-bottom: 12px; }
.tchart-modh { display: flex; align-items: center; gap: 5px; font-weight: 600; font-size: 12.5px; margin-bottom: 5px; }
.tchart-modh svg { width: 13px; height: 13px; }
.tchart-row { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 3px; }
.tchart-lbl { flex: 0 0 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.tchart-track { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.tchart-fill { height: 7px; border-radius: 3px; min-width: 1px; }
.tchart-fill.est { background: color-mix(in srgb, var(--muted) 45%, transparent); }
.tchart-fill.real { background: var(--accent); }
.tchart-val { flex: 0 0 60px; text-align: right; font-variant-numeric: tabular-nums; }
.tchart-legend { display: flex; gap: 14px; font-size: 12px; margin-bottom: 10px; }
.tchart-legend i { display: inline-block; width: 18px; height: 8px; border-radius: 3px; vertical-align: middle; margin-right: 4px; }
/* Calendrier temps (heatmap) */
.tcal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tcal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.tcal-dow { text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; padding-bottom: 2px; }
.tcal-cell { aspect-ratio: 1; border-radius: 7px; border: 1px solid var(--border); background: var(--panel-2); padding: 4px 6px; display: flex; flex-direction: column; justify-content: space-between; min-height: 44px; }
.tcal-cell.empty { background: none; border: none; }
.tcal-d { font-size: 11px; color: var(--muted); }
.tcal-h { font-size: 12px; font-weight: 700; align-self: flex-end; }
.tcal-cell.i1 { background: color-mix(in srgb, var(--accent) 18%, var(--panel-2)); }
.tcal-cell.i2 { background: color-mix(in srgb, var(--accent) 38%, var(--panel-2)); }
.tcal-cell.i3 { background: color-mix(in srgb, var(--accent) 60%, var(--panel-2)); }
.tcal-cell.i4 { background: var(--accent); color: #fff; }
.tcal-cell.i3 .tcal-d, .tcal-cell.i4 .tcal-d { color: rgba(255,255,255,.85); }
.tcal-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; font-size: 11px; margin-top: 8px; }
.tcal-legend i { width: 16px; height: 16px; min-height: 0; aspect-ratio: auto; padding: 0; }
.mod-section { margin-top: 10px; }
.mod-h { display: flex; align-items: center; gap: 6px; margin: 18px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); font-size: 16px; }
.mod-h svg { width: 16px; height: 16px; color: var(--accent); }
.pc-modgroup { display: flex; flex-direction: column; gap: 5px; padding: 6px 0; border-top: 1px dashed var(--border); }
.pc-modgroup:first-child { border-top: none; padding-top: 0; }
.pc-modhead { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.pc-modhead svg { width: 13px; height: 13px; }
.pc-modhead .pcg-prog { margin-left: auto; font-size: 11px; }
.pc-phase { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.pcp-label { flex: 0 0 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.pcp-track { flex: 1; height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.pcp-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .2s; }
.pcp-fill.full { background: var(--ok); }
.pcp-count { flex: 0 0 36px; text-align: right; font-size: 11px; }

/* Estimation de référence vs tâches générées (indicatif) */
.pc-est { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.pc-est b { color: var(--text); }
.pc-est-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }

/* Barre temps consommé / estimé (avec dépassement) */
.tb-meta { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.tb-over { color: var(--red); font-weight: 700; }
.tb-track { display: flex; height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.tb-fill { height: 100%; background: var(--ok); }
.tb-fill.over-base { background: var(--warn); }
.tb-fill.over { background: var(--red); }

/* Lignes de réglage notifications */
.notif-row { margin: 6px 0; padding: 8px 12px; }

/* Staffing projet (responsable + membres) */
.pc-staff { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pc-resp { font-size: 12.5px; padding: 2px 9px; border-radius: 999px; background: rgba(79,156,249,.12); border: 1px solid var(--accent); color: var(--accent); white-space: nowrap; }
.chip.staff { background: var(--panel-2); border: 1px solid var(--border); }
.btn.ghost.pc-addstaff { padding: 3px 9px; font-size: 12px; }

/* Carte Kanban verrouillée (tâche d'un autre membre, pour un non-admin) */
.kcard-locked { opacity: .5; cursor: default; }
.kcard-locked:hover { transform: none; box-shadow: none; }

/* Billable / type projet + maintenance */
.pc-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.pc-badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 6px; border: 1px solid; }
.pc-badge.maint { color: var(--warn); border-color: var(--warn); background: rgba(224,168,0,.1); }
.pc-badge.nonbill { color: var(--muted); border-color: var(--border); background: var(--panel-2); }
.pc-tickets { font-size: 13px; padding: 6px 0; }
/* Plans préventifs */
.mp-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; flex-wrap: wrap; }
.mp-row:first-of-type { border-top: none; }
.mp-due { color: var(--red); font-weight: 700; }

/* PWA plein écran : respecter l'encoche / la barre d'accueil sur mobile */
@media (display-mode: standalone) {
  .sidebar { padding-top: calc(16px + env(safe-area-inset-top)); }
  main { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  #timerbar { bottom: calc(12px + env(safe-area-inset-bottom)); }
}

/* ============================================================
   RESPONSIVE MOBILE (≤ 760px) — PWA / téléphones
   ============================================================ */
@media (max-width: 760px) {
  body { flex-direction: column; }

  /* Sidebar → barre d'onglets fixe en bas (pattern mobile natif) */
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; width: 100%; height: auto;
    flex-direction: row; align-items: stretch; gap: 0; overflow: visible;
    padding: 4px 0 calc(4px + env(safe-area-inset-bottom)); z-index: 60;
    border-right: none; border-top: 1px solid var(--border);
  }
  .sidebar .brand { display: none; }
  #mainnav { flex-direction: row; flex: 1; justify-content: space-around; gap: 0; }
  .snav-btn { flex-direction: column; gap: 2px; padding: 4px 2px; flex: 1; min-width: 0; border: none; border-radius: 0; background: none; }
  .snav-btn.active { background: none; color: var(--text); }
  .snav-btn.active::before { display: none; }
  .snav-icon { width: 26px; height: 26px; border-radius: 8px; }
  .snav-icon svg { width: 15px; height: 15px; }
  .snav-label { font-size: 9px; letter-spacing: -.2px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  /* Profil compact (roue) flottant en haut a droite ; deconnexion via la page profil */
  #userchip {
    position: fixed; top: 8px; right: 10px; z-index: 70; width: auto; margin: 0;
    padding: 0; border-top: none; display: flex; align-items: center;
  }
  #userchip #logout { display: none; }
  .uc-name { font-size: 0; width: auto; margin: 0; padding: 6px 9px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; }
  .uc-name .uc-admin { display: none; }
  .uc-name .uc-gear { font-size: 17px; margin: 0; color: var(--text); }

  /* Contenu (place pour la barre du bas + profil flottant) */
  main { padding: 14px 12px calc(74px + env(safe-area-inset-bottom)); }
  .subnav { padding: 0 102px 0 8px; min-height: 44px; }
  #timerbar { bottom: calc(70px + env(safe-area-inset-bottom)) !important; }
  h2 { font-size: 21px; }

  /* Standard iOS : champs ≥ 16px sinon Safari zoome au focus */
  input, select, textarea { font-size: 16px; }
  /* Cibles tactiles : boutons-icônes ✎ × ▲ ▼ → zone d'au moins ~40px (Apple HIG 44) */
  button.icon { min-width: 36px; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; }
  .pd-acts .btn, .toolbar .btn, .pc-actions .btn { min-height: 40px; }

  /* #5 — Barres d'outils compactes : une seule ligne défilante (récupère la hauteur d'écran) */
  .toolbar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 6px; margin: 12px 0 14px; scrollbar-width: none; }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar > * { flex-shrink: 0; }

  /* Cartes KPI */
  .row { gap: 8px; }
  .row .card { flex: 1 1 130px; }
  .card { padding: 12px 14px; }
  .card .n { font-size: 24px; }

  /* Grilles → 1 colonne (y compris les grilles inline 2 colonnes) */
  .proj-grid { grid-template-columns: 1fr; }
  .exp-kpis { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }

  /* Tableaux → bloc scrollable horizontalement, colonnes préservées */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  th, td { padding: 8px 10px; }
  /* Table déjà dans un conteneur scrollable (style="overflow-x") → garder le table natif
     (sinon double scroll qui casse la colonne figée) ; le wrapper assure le défilement */
  [style*="overflow-x"] > table { display: table; width: 100%; }
  /* #6 — 1re colonne (libellé de ligne) figée pendant le défilement horizontal */
  table td:first-child, table th:first-child { position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--border); }
  table td:first-child { background: var(--panel); }
  table th:first-child { background: var(--panel-2); z-index: 2; }
  .occ-table td.occ-name, .occ-table th:first-child { background: var(--panel-2); }

  /* Modales adaptées à l'écran */
  dialog { width: auto !important; max-width: 94vw !important; padding: 16px; }

  /* Kanban façon Trello : colonnes en pagination horizontale (scroll-snap),
     chaque liste défile verticalement de façon indépendante, en-tête fixe en haut */
  .kboard { display: flex; grid-template-columns: none; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory; scroll-padding-left: 12px; gap: 10px; padding-bottom: 6px; }
  .kboard > .kcol { width: 82vw; min-width: 0; flex: 0 0 auto; scroll-snap-align: start;
    display: flex; flex-direction: column; max-height: calc(100dvh - 250px); min-height: 230px; }
  .kboard > .kcol .kbody { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-right: 2px; }
  /* Déplacement tactile : sélecteur de statut visible sur chaque carte */
  .kmove { display: block; width: 100%; margin-top: 9px; }
  .kmove input[type="text"] { font-size: 13px; padding: 8px; border-radius: 7px; }
  .pboard { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; gap: 10px; }
  .pboard > .kcol { min-width: 78vw; flex: 0 0 auto; scroll-snap-align: start; }
  .kcard { cursor: default; }

  /* Calendrier semaine & planning → scroll horizontal */
  .wk, .lv-week { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .wk-row, .wk-body { min-width: 640px; }
  .lv-grid { min-width: 560px; }

  /* Calendrier mois → cellules lisibles, en-têtes compacts, libellé de barre dégagé */
  .toolbar strong { min-width: 0 !important; }
  .cal-grid { gap: 0; }
  .cal-dow { text-align: center; padding: 6px 2px; font-size: 9px; letter-spacing: 0; }
  .cal-cell { min-height: 74px; padding: 3px 4px 5px; font-size: 11px; }
  .cal-num { font-size: 11px; min-width: 18px; height: 18px; margin-bottom: 2px; }
  .cal-cell .ev { font-size: 9.5px; padding: 1px 4px; margin-bottom: 2px; line-height: 1.35; }

  /* Mini-gantt projet */
  .grow { grid-template-columns: 110px 1fr; }
}

/* Lien dans une puce (édition staffing) */
.lk { background: none; border: none; color: var(--text); cursor: pointer; font: inherit; padding: 0; text-decoration: underline dotted; }
.lk:hover { color: var(--accent); }

/* Plan de charge — timeline */
.wl { margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--panel); }
.wl-row, .wl-person { display: grid; grid-template-columns: 150px 1fr; align-items: stretch; }
.wl-head { border-bottom: 1px solid var(--border); background: var(--panel-2); }
.wl-label { padding: 8px 12px; font-size: 13px; display: flex; align-items: center; gap: 6px; border-right: 1px solid var(--border); }
.wl-person .wl-label { font-weight: 600; }
.wl-person { border-bottom: 1px solid var(--border); }
.wl-person:last-child { border-bottom: none; }
.wl-track { position: relative; height: 30px; }
.wl-month { position: absolute; top: 0; height: 100%; border-left: 1px solid var(--border); font-size: 11px; color: var(--muted); padding: 7px 0 0 6px; text-transform: capitalize; box-sizing: border-box; }
.wl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--red); z-index: 3; }
.wl-lanes { padding: 5px 0; position: relative; display: flex; flex-direction: column; gap: 4px; }
.wl-lane { position: relative; height: 24px; }
.wl-bar { position: absolute; top: 0; height: 24px; border: 1px solid; border-radius: 6px; display: flex; align-items: center; overflow: hidden; box-sizing: border-box; }
.wl-bar-t { font-size: 11px; padding: 0 7px; white-space: nowrap; color: var(--text); }

/* Plan de charge — occupation dynamique (Lot 1) */
.occ-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13px; background: var(--panel); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.occ-table th, .occ-table td { border: 1px solid var(--border); padding: 7px 8px; text-align: center; }
.occ-table th { background: var(--panel-2); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.occ-table .occ-name { text-align: left; white-space: nowrap; }
td.occ { font-weight: 600; font-variant-numeric: tabular-nums; cursor: default; }
td.occ-zero { color: var(--muted); font-weight: 400; }
td.occ-ok   { background: rgba(63,185,80,.14);  color: var(--ok); }
td.occ-high { background: rgba(224,168,0,.16);  color: var(--warn); }
td.occ-over { background: rgba(225,29,42,.18);  color: var(--red); }
.occ-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.occ-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.occ-legend i.occ-ok { background: rgba(63,185,80,.5); } .occ-legend i.occ-high { background: rgba(224,168,0,.6); } .occ-legend i.occ-over { background: var(--red); }

/* Éditeur de phases (Lot 2) */
.ph-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-height: 52vh; overflow-y: auto; }
.ph-row { display: flex; align-items: center; gap: 6px; }
.ph-pos { width: 20px; text-align: center; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.ph-name { flex: 1 1 auto; min-width: 100px; }
.ph-mod, .ph-lead { flex: 0 1 140px; min-width: 0; }   /* min-width:0 → le select peut rétrécir sous sa plus longue option */
.ph-add-row select { flex: 0 1 140px; min-width: 0; }
.ph-row select, .ph-add-row select { text-overflow: ellipsis; }
.ph-row .icon { flex-shrink: 0; }

/* Documents personnels (Lot 7) */
.doc-group { margin-top: 14px; }
.doc-group:first-child { margin-top: 0; }
.doc-group-h { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; margin-bottom: 7px; }
.doc-group-h .btn { margin-left: auto; padding: 3px 10px; font-size: 12px; }
.doc-row { display: flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 5px; background: var(--panel-2); }
.doc-link { color: var(--text); font-weight: 500; text-decoration: none; }
.doc-link:hover { color: var(--red); text-decoration: underline; }
.doc-meta { font-size: 11px; margin-left: auto; }
.doc-row .icon { flex-shrink: 0; }
.doc-empty { font-size: 12px; padding: 2px 0 6px; }

/* Graphe comparaison coût vs chiffre (rapport Temps) */
.cmp { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.cmp-row { display: grid; grid-template-columns: 140px 1fr; align-items: center; gap: 10px; }
.cmp-name { font-size: 13px; }
.cmp-bars { display: flex; flex-direction: column; gap: 4px; }
.cmp-bar { position: relative; height: 18px; background: var(--panel-2); border-radius: 5px; display: flex; align-items: center; }
.cmp-fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 5px; }
.cmp-fill.cost { background: var(--red-soft); }
.cmp-fill.rev { background: var(--ok); }
.cmp-bar b { position: relative; font-size: 11px; padding-left: 7px; color: var(--text); }
.cmp-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.cmp-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.cmp-legend i.cost { background: var(--red-soft); }
.cmp-legend i.rev { background: var(--ok); }

/* Bascule cartes / tableau */
.sv-toggle { display: inline-flex; gap: 0; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.sv-toggle .btn { border: 0; border-radius: 0; padding: 6px 14px; }
.sv-toggle .btn.active { background: var(--red); color: #fff; }

/* Partenariat éditeur : statut, échéances et démarches administratives */
.pt-block { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.pt-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.pt-steps-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 4px; }
.pt-steps-head span { display: flex; gap: 6px; }
.pt-block table { margin-top: 4px; }

/* Planning projet : statut modifiable dans le tableau, sans ouvrir la fiche tâche */
.pstatus { min-width: 148px; }
.pstatus .combo { min-width: 132px; }
.pstatus .combo-q { padding: 6px 30px 6px 9px; font-size: 12px; }
/* Planification hebdo : même sélecteur, mais sur la carte (pleine largeur) */
.pwstatus { display: block; width: 100%; margin-top: 8px; }
.pwstatus .combo { min-width: 0; width: 100%; }
.pwstatus .combo-q { padding: 6px 28px 6px 8px; font-size: 12px; border-radius: 7px; }
/* Confort tactile aligné sur le sélecteur de statut du kanban (déclaré après les règles de base
   ci-dessus, sinon même spécificité et c'est le desktop qui gagnerait). */
@media (max-width: 760px) {
  .pstatus .combo-q { font-size: 13px; padding: 9px 30px 9px 9px; }
  .pwstatus .combo-q { font-size: 13px; padding: 9px 28px 9px 8px; }
}

/* Répartition du coût interne : facturé / non facturé / non pointé */
.csplit { display: flex; height: 18px; border-radius: 5px; overflow: hidden; margin-top: 10px; background: var(--border); }
.csplit-seg { display: block; height: 100%; }
.csplit-leg { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.csplit-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.csplit-leg b { color: var(--text); }

/* Formation — parcours d'apprentissage */
.lp-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.lp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.lp-prog { display: flex; align-items: center; gap: 8px; font-size: 12px; min-width: 160px; }
.lp-bar { flex: 1; height: 7px; border-radius: 999px; background: var(--panel-2); overflow: hidden; min-width: 90px; }
.lp-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .25s; }
.lp-fill.full { background: var(--ok); }
.lp-stage { margin-top: 8px; }
.lp-stage-h { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; margin: 6px 0 4px; }
.lp-step { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; font-size: 13.5px; }
.lp-step:hover { background: var(--panel-2); }
.lp-step.done .lp-stitle { color: var(--muted); text-decoration: line-through; }
.lp-check { width: 22px; height: 22px; flex-shrink: 0; border-radius: 6px; border: 1.5px solid var(--border); background: none; color: #fff; cursor: pointer; font-size: 13px; line-height: 1; }
.lp-check.on { background: var(--ok); border-color: var(--ok); }
.lp-stype { flex-shrink: 0; }
.lp-stitle { flex: 1; min-width: 0; }
.lp-smeta { flex-shrink: 0; font-size: 11.5px; white-space: nowrap; }
.lp-res { font-size: 12px; }
.lp-res.muted { color: var(--muted); }
a.lp-res { color: var(--accent); text-decoration: none; }
a.lp-res:hover { text-decoration: underline; }
.lp-timer.run { color: var(--red); }
.lp-actions { display: flex; gap: 8px; margin-top: 10px; }

/* Guide d'utilisation intégré */
.gd-search { width: 100%; max-width: 480px; margin: 6px 0 14px; }
#gd-list { display: flex; flex-direction: column; gap: 8px; }
details.gd { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
details.gd > summary { cursor: pointer; padding: 13px 16px; font-weight: 600; font-size: 15px; list-style: none; user-select: none; display: flex; align-items: center; gap: 8px; }
details.gd > summary::-webkit-details-marker { display: none; }
details.gd > summary::before {
  content: ""; width: 13px; height: 13px; flex: 0 0 auto; background: var(--muted); transition: transform .15s;
  transform: rotate(-90deg);
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7.5 10 12.5 15 7.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
details.gd[open] > summary::before { transform: rotate(0deg); }
details.gd > summary:hover { background: var(--panel-2); }
.gd-body { padding: 2px 18px 14px 38px; font-size: 14px; line-height: 1.65; }
.gd-body ul { margin: 4px 0; padding-left: 18px; }
.gd-body li { margin-bottom: 7px; }
.gd-body b { color: var(--text); }
.gd-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 1px 7px; border-radius: 999px; vertical-align: middle; }
.gd-badge.admin { color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 40%, var(--border)); }

/* Agenda de temps (vue Temps) — l'en-tête reste, la grille horaire réutilise .wk/.tev ci-dessus */
.tcal-top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

/* Mon espace — accueil personnel : accès rapides, to-do, pointage du jour */
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.home-phrase { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding: 6px 6px 6px 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.home-phrase:focus-within { border-color: var(--red); }
.hph-ic { color: var(--red); display: inline-flex; }
.hph-ic svg { width: 18px; height: 18px; }
.home-phrase input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 4px; font-size: 15px; }
.home-phrase input:focus { outline: none; }
.gap-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border)); background: color-mix(in srgb, var(--warn) 9%, var(--panel)); }
.gap-ic { color: var(--warn); display: inline-flex; }
.gap-txt { font-size: 13px; font-weight: 600; margin-right: 2px; }
.home-h { margin: 22px 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.qa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.qa-tile { display: flex; align-items: center; gap: 10px; padding: 12px 14px; text-align: left; cursor: pointer; font: inherit; color: var(--text);
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; min-width: 0; }
.qa-tile:hover { transform: translateY(-2px); border-color: var(--sc); }
.qa-ic { flex: 0 0 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--sc); background: color-mix(in srgb, var(--sc) 14%, transparent); }
.qa-ic svg { width: 18px; height: 18px; }
.qa-txt { display: flex; flex-direction: column; min-width: 0; }
.qa-txt b, .qa-txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-txt small { color: var(--muted); font-size: 12px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 14px; margin-top: 18px; align-items: start; }
.home-card-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.todo-add { display: flex; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.todo-add #h-add-title { flex: 3 1 200px; }
.todo-add .combo { flex: 1 1 120px; width: auto; min-width: 120px; }
.todo-add input[type="date"] { flex: 0 1 150px; }
.todo-group { margin-top: 14px; }
.todo-gh { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 4px; }
.todo-group.late .todo-gh { color: var(--red); }
.todo-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px 6px 10px; border-bottom: 1px solid var(--border); border-left: 3px solid transparent; }
.todo-row:last-child { border-bottom: 0; }
.todo-row.prio-haute { border-left-color: var(--warn); }
.todo-row.prio-critique { border-left-color: var(--red); }
.todo-row.running { background: var(--red-dim); }
.todo-check { width: 18px; height: 18px; flex: 0 0 18px; margin: 0; cursor: pointer; accent-color: var(--ok); }
.todo-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; background: none; border: 0; padding: 2px 0; text-align: left; color: var(--text); font: inherit; cursor: pointer; }
.todo-title { overflow-wrap: anywhere; }
.todo-main:hover .todo-title { text-decoration: underline; }
.todo-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.todo-meta .chip { margin: 0; }
.todo-due { color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.todo-due.late { color: var(--red); font-weight: 600; }
.todo-act { flex: 0 0 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; color: var(--muted); }
.todo-act:hover, .todo-act.on { color: var(--red); border-color: var(--red); }
.hp-stat { display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px; }
.hp-stat > span:first-child { flex: 1; color: var(--muted); font-size: 13px; }
.hp-stat b { font-size: 20px; font-variant-numeric: tabular-nums; }
.hp-bar { height: 8px; min-width: 0; }
.hp-list { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 8px; }
.hp-entry { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 2px; background: none; border: 0; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; border-radius: 6px; }
.hp-entry:hover:not(:disabled) { background: var(--panel-2); }
.hp-entry:disabled { cursor: default; }
.hp-entry .hp-lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-entry b { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

.hp-meet { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 8px; }
.hp-meet-h { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 4px; }
.hp-meet-row { display: flex; align-items: center; gap: 8px; padding: 4px 2px; font-size: 13px; }
.hp-meet-row .hp-lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-meet-row .pt-chip { padding: 3px 10px; font-size: 12px; }

/* Planning automatique (onglet Planning du projet) */
.sched-box { padding: 12px 16px; }
.sched-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sched-head .pill { display: inline-flex; align-items: center; gap: 5px; }
.sched-rules { font-size: 12.5px; margin: 8px 0 0; }
.sched-warn { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; color: var(--warn); }
.sched-warn li { display: flex; gap: 6px; align-items: baseline; margin: 2px 0; }
dialog.sched-dlg { width: 760px; }
.sched-list { max-height: 46vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.sched-list table { margin: 0; font-size: 13px; }
.sched-list th { position: sticky; top: 0; background: var(--panel); }
td.ord-cell { white-space: nowrap; padding: 4px 6px; }
td.ord-cell .icon { padding: 2px; }
td.ord-cell .icon:disabled { opacity: .25; cursor: default; }

/* Copier une journée */
.cp-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.cp-list:empty { display: none; }
.cp-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--border); }
.cp-row:last-child { border-bottom: 0; }
.cp-row input { width: 16px; height: 16px; margin: 0; flex: 0 0 16px; accent-color: var(--red); }
.cp-row .cp-lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-row b { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cp-row.dup .cp-lbl { color: var(--muted); }

/* Dialog de pointage — raccourcis cliquables (récents, date, durée) */
dialog.pt-dialog { width: 600px; max-width: 94vw; }
.pt-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pt-chips input { width: auto; }
.pt-chips #mt-dur { width: 110px; }
.pt-chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.pt-chip:hover:not(:disabled) { border-color: var(--red); }
.pt-chip.active { border-color: var(--red); background: var(--red-dim); color: var(--red); font-weight: 600; }
.pt-chip:disabled { opacity: .45; cursor: default; }
.pt-recent { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
/* Dictée vocale : bouton micro (rouge et pulsant pendant l'écoute) */
.mic-btn { flex: 0 0 auto; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  border-radius: 50%; border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); padding: 0; }
.mic-btn svg { width: 17px; height: 17px; }
.mic-btn:hover { color: var(--red); border-color: var(--red); }
.mic-btn.on { color: #fff; background: var(--red); border-color: var(--red); animation: pulse 1.2s infinite; }
.pt-phrase-wrap { position: relative; }
.pt-phrase-wrap input { padding-right: 46px; }
.pt-phrase-wrap .mic-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; }
/* Pointage en une phrase : ce qui a été reconnu, sous le champ */
.pt-detect { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.pt-detect-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pt-tag { display: inline-flex; align-items: baseline; gap: 5px; padding: 3px 9px; border-radius: 6px; font-size: 13px;
  background: var(--panel-2); border: 1px solid var(--border); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-tag small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.pt-tag.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.pt-create { color: var(--accent); border-style: dashed; }
.pt-more { font-size: 12px; color: var(--muted); }

@media (max-width: 760px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-phrase .btn { min-height: 40px; }
  .qa-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .qa-tile { padding: 10px; }
  .todo-add #h-add-title { flex-basis: 100%; }
  .todo-act { flex-basis: 38px; height: 38px; }
  .todo-check { width: 22px; height: 22px; flex-basis: 22px; }
}

/* Rapport détaillé — export impression/PDF propre (sidebar/filtres masqués, en-tête imprimable affiché) */
.print-head { margin: 10px 0 4px; }
@media print {
  .sidebar, .subnav, #toasts, #timerbar, .no-print { display: none !important; }
  .content-wrap, main { overflow: visible !important; padding: 0 !important; margin: 0 !important; }
  .print-head { display: block !important; }
  .sol-card, table { break-inside: avoid; }
  body { background: #fff; color: #000; }
}
