/* ==========================================================================
   TAGFLEET Manager — styles
   Tokens et composants du design « TAGFLEET Manager v2 » (handoff du 11/10).
   Couleur jamais seule : toujours icône + libellé.
   ========================================================================== */

:root {
  --bg: #FFFFFF; --sf: #FFFFFF; --sf2: #F5F5F5; --bd: #EDEDED;
  --fg: #111827; --mu: #4B5563;
  --pri: #111827; --pri-fg: #FFFFFF;
  --red-bg: #FEE2E2; --red-fg: #991B1B;
  --org-bg: #FEF3C7; --org-fg: #92400E;
  --grn-bg: #D1FAE5; --grn-fg: #065F46;
  --acc: #38BDF8; --bar: #E5E5E5;
  --overlay: rgba(0,0,0,.5);
  --sh-md: 0 4px 12px -2px rgba(17,24,39,.08);
  --sh-lg: 0 12px 32px -8px rgba(17,24,39,.12), 0 4px 8px -4px rgba(17,24,39,.06);
  --ease: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0A0A0A; --sf: #0A0A0A; --sf2: #1A1A1A; --bd: #262626;
  --fg: #FAFAFA; --mu: #A3A3A3;
  --pri: #FAFAFA; --pri-fg: #111827;
  --red-bg: #3B1518; --red-fg: #FCA5A5;
  --org-bg: #37280B; --org-fg: #FCD34D;
  --grn-bg: #0C2E23; --grn-fg: #6EE7B7;
  --bar: #333333;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--fg); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mu { color: var(--mu); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: inherit; }

/* ── Boutons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 10px; border: 1.5px solid transparent;
  font-size: 15px; font-weight: 600; white-space: nowrap; background: transparent;
  transition: background-color var(--ease), color var(--ease), border-color var(--ease), opacity var(--ease);
}
a.btn { text-decoration: none; }
.btn-pri { background: var(--pri); color: var(--pri-fg); border-color: var(--pri); }
.btn-pri:hover { background: transparent; color: var(--fg); }
.btn-sec { border-color: var(--fg); color: var(--fg); }
.btn-sec:hover { background: var(--pri); color: var(--pri-fg); border-color: var(--pri); }
.btn-dis { color: var(--mu); }
.btn-dis:hover { background: var(--sf2); color: var(--fg); }
.btn-ico { width: 44px; min-width: 44px; padding: 0; color: var(--mu); }
.btn-ico:hover { background: var(--sf2); color: var(--fg); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-lg { min-height: 48px; }
.btn-xl { min-height: 52px; width: 100%; }

/* ── Pastilles ────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap;
}
.pill i { font-size: 12px; }
.p-red { background: var(--red-bg); color: var(--red-fg); }
.p-org { background: var(--org-bg); color: var(--org-fg); }
.p-grn { background: var(--grn-bg); color: var(--grn-fg); }
.p-neu { background: var(--sf2); color: var(--mu); }

/* ── Coquille ─────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; flex: none; width: 248px;
  display: flex; flex-direction: column; gap: 8px; padding: 16px 12px;
  background: var(--bg); border-right: 1px solid var(--bd); transition: width var(--ease);
}
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; min-height: 48px; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 8px; flex: none; display: grid; place-items: center;
  background: var(--pri); color: var(--pri-fg); font-weight: 800; font-size: 16px; letter-spacing: -.03em;
}
.logo b { display: block; font-size: 15px; font-weight: 800; letter-spacing: .02em; line-height: 1.1; }
.logo small { display: block; font-size: 13px; color: var(--mu); line-height: 1.2; }
.side .btn-quick { width: 100%; margin-bottom: 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: 10px; background: transparent; color: var(--mu); font-size: 15px; font-weight: 500; text-align: left;
  transition: background-color var(--ease), color var(--ease);
}
.nav button i { width: 20px; text-align: center; font-size: 16px; }
.nav button:hover { background: var(--sf2); color: var(--fg); }
.nav button[aria-current="page"] { background: var(--sf2); color: var(--fg); font-weight: 700; }
.nav button[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--acc);
}
.nav .badge {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--red-bg); color: var(--red-fg); font-size: 12px; font-weight: 700; display: grid; place-items: center;
}
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.side-foot button { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px;
  background: none; color: var(--mu); font-size: 14px; font-weight: 500; }
.side-foot button:hover { background: var(--sf2); color: var(--fg); }
.side-foot button i { width: 20px; text-align: center; }

/* Barre latérale repliée : icônes seules */
.side.fold { width: 76px; align-items: center; }
.side.fold .lbl, .side.fold .logo-txt { display: none; }
.side.fold .logo { padding: 4px 0 12px; }
.side.fold .btn-quick { width: 44px; padding: 0; }
.side.fold .nav button, .side.fold .side-foot button { justify-content: center; padding: 0; width: 52px; }
.side.fold .nav .badge { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; }

.col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 40px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bd);
}
.search {
  flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--bd); border-radius: 12px; background: var(--sf); color: var(--mu); font-size: 15px; text-align: left;
}
.search:hover { border-color: var(--mu); }
.search span { flex: 1; }
kbd { font-family: var(--font); font-size: 12px; font-weight: 600; padding: 2px 6px; border-radius: 6px; background: var(--sf2); color: var(--mu); }
.timer-pill {
  margin-left: auto; display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 6px 0 14px;
  border-radius: 999px; background: var(--sf2); font-size: 14px; font-weight: 600;
}
.timer-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red-fg); animation: pulse 1.4s infinite; }
.timer-pill button { min-height: 32px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--pri); color: var(--pri-fg); font-size: 13px; font-weight: 600; }

.mtop, .tband, .bottom { display: none; }

.main { width: 100%; max-width: 1200px; margin: 0 auto; padding: 32px 40px 64px; }

/* ── Titres et blocs ──────────────────────────────────────────────── */
.eyebrow { font-size: 13px; font-weight: 500; color: var(--mu); margin: 0 0 6px; }
h1.h1 { font-size: clamp(30px, 4vw, 40px); line-height: 1.05; font-weight: 700; letter-spacing: -.035em; margin: 0; }
.h1-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
h2.h2 { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 16px; }
h2.h2 .ic { display: grid; place-items: center; font-size: 18px; background: none !important; }
h2.h2 .n { color: var(--mu); font-weight: 500; }
.stack { display: flex; flex-direction: column; }
.gap40 > * + * { margin-top: 40px; }
.gap32 > * + * { margin-top: 32px; }
.gap48 > * + * { margin-top: 48px; }
.card { background: var(--sf); border: 1px solid var(--bd); border-radius: 16px; padding: 24px; }
.hint { font-size: 13px; color: var(--mu); margin: -8px 0 12px; }

/* Bandeau du mois : une ligne entre deux filets */
.band {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 16px 24px;
  padding: 20px 0; border-top: 1px solid var(--bd); border-bottom: 1px solid var(--bd);
}
.stat .l { font-size: 13px; font-weight: 500; color: var(--mu); }
.stat .v { font-size: 28px; font-weight: 600; letter-spacing: -.03em; line-height: 1.2; margin-top: 2px; }
.stat .d { font-size: 13px; color: var(--mu); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.stat .d i { font-size: 11px; }

/* ── Carte d'action ───────────────────────────────────────────────── */
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.awrap { position: relative; border-radius: 16px; overflow: hidden; }
.aunder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
  font-size: 15px; font-weight: 700; border-radius: 16px;
}
.aunder.done { background: var(--grn-bg); color: var(--grn-fg); }
.aunder.later { background: var(--org-bg); color: var(--org-fg); justify-content: flex-end; }
.acard {
  position: relative; background: var(--sf); border: 1px solid var(--bd); border-radius: 16px; padding: 16px;
  display: flex; flex-direction: column; gap: 14px; height: 100%; touch-action: pan-y;
  transition: transform var(--ease), border-color var(--ease);
}
.acard.dragging { transition: none; }
.ahead { display: flex; gap: 14px; align-items: flex-start; }
.aico { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 17px;
  background: var(--red-bg); color: var(--red-fg); }
.atitle { font-size: 16px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
.ameta { font-size: 14px; color: var(--mu); margin-top: 2px; }
.ameta button { border: 0; background: none; padding: 0; color: inherit; font: inherit; text-decoration: underline; text-decoration-color: var(--bd); text-underline-offset: 3px; }
.ameta button:hover { color: var(--fg); }
.arow { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: auto; }
.arow .btn-pri { margin-right: 4px; }
@media (hover: hover) {
  .acard .later-btns, .lrow .later-ico { opacity: 0; transition: opacity var(--ease); }
  .acard:hover .later-btns, .acard:focus-within .later-btns, .lrow:hover .later-ico, .lrow:focus-within .later-ico { opacity: 1; }
}
.later-btns { display: inline-flex; gap: 4px; }

/* Lignes « À prévoir » */
.list { background: var(--sf); border: 1px solid var(--bd); border-radius: 16px; }
.lrow { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 12px 10px 16px; border-top: 1px solid var(--bd); }
.lrow:first-child { border-top: 0; }
.lico { width: 20px; flex: none; display: grid; place-items: center; font-size: 15px; color: var(--mu); }
.lmain { flex: 1; min-width: 0; }
.lmain .t { font-size: 15px; font-weight: 600; line-height: 1.35; border: 0; background: none; padding: 0; text-align: left; }
.lmain button.t:hover { text-decoration: underline; text-underline-offset: 3px; }
.lmain .m { font-size: 13px; color: var(--mu); }
.lright { flex: none; display: flex; align-items: center; gap: 2px; }
.lright .r { font-size: 14px; font-weight: 600; margin-right: 8px; }

/* Tout va bien */
.allgood { display: flex; gap: 16px; align-items: center; }
.allgood .aico { background: var(--grn-bg); color: var(--grn-fg); }
.okline {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px; text-align: left;
  border: 1px solid var(--bd); border-radius: 16px; background: var(--sf); font-size: 14px; color: var(--mu);
}
.okline:hover { border-color: var(--mu); }
.okline .names { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oklist { margin-top: 8px; }

/* ── Projets ──────────────────────────────────────────────────────── */
.filters { display: flex; flex-direction: column; gap: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--bd); background: var(--sf); color: var(--fg); font-size: 14px; font-weight: 500;
  transition: background-color var(--ease), color var(--ease), border-color var(--ease);
}
.chip:hover { border-color: var(--mu); }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--pri); color: var(--pri-fg); border-color: var(--pri); font-weight: 600; }
.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px; background: var(--sf2); }
.seg button {
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--fg);
  font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px;
}
.seg button[aria-checked="true"] { background: var(--sf); font-weight: 700; box-shadow: 0 1px 2px rgba(17,24,39,.08); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 16px; }
.pcard {
  width: 100%; text-align: left; background: var(--sf); border: 1px solid var(--bd); border-radius: 16px; padding: 24px;
  display: flex; flex-direction: column; gap: 14px; transition: border-color var(--ease);
}
.pcard:hover { border-color: var(--mu); }
.pcard .name { font-size: 18px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; }
.pcard .pills { display: flex; gap: 6px; flex-wrap: wrap; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.three .l { font-size: 12px; color: var(--mu); font-weight: 500; }
.three .v { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.pcard .next { border-top: 1px solid var(--bd); padding-top: 14px; font-size: 14px; color: var(--mu); line-height: 1.4; }
.pcard .next b { color: var(--fg); font-weight: 600; }

/* ── Fiche projet ─────────────────────────────────────────────────── */
.back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px 0 4px; margin-left: -4px;
  border: 0; background: none; color: var(--mu); font-size: 14px; font-weight: 600; border-radius: 10px; }
.back:hover { color: var(--fg); background: var(--sf2); }
.phead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.phead .pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.pstats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 20px 0; border-top: 1px solid var(--bd); border-bottom: 1px solid var(--bd); }
.tabs {
  position: sticky; top: 64px; z-index: 20; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  background: var(--bg); border-bottom: 1px solid var(--bd);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none; min-height: 48px; padding: 0 14px; border: 0; background: none; color: var(--mu); font-size: 15px; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--fg); font-weight: 700; border-bottom-color: var(--fg); }
.tabs button:hover { color: var(--fg); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; align-items: start; }
.rows > * { border-top: 1px solid var(--bd); }
.rows > *:first-child { border-top: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; min-height: 52px; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-size: 15px; font-weight: 500; line-height: 1.35; }
.row .m { font-size: 13px; color: var(--mu); }
.row .a { font-size: 15px; font-weight: 600; }
.row .rico { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--sf2); color: var(--mu); }
.total { display: flex; justify-content: space-between; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--fg); font-weight: 700; }
.card h3 { font-size: 18px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 8px; }

.bars { display: flex; align-items: flex-end; gap: 12px; height: 168px; padding-top: 8px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bars .b i { display: block; width: 100%; max-width: 56px; border-radius: 6px 6px 2px 2px; }
.bars .b .v { font-size: 12px; font-weight: 600; color: var(--mu); }
.bars .b .m { font-size: 12px; color: var(--mu); }
.chart-sum { font-size: 14px; color: var(--mu); margin-top: 12px; }

.dur { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.big { font-size: 28px; font-weight: 600; letter-spacing: -.03em; }

/* ── Tableaux ─────────────────────────────────────────────────────── */
.tcard { background: var(--sf); border: 1px solid var(--bd); border-radius: 16px; overflow: hidden; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 13px; font-weight: 500; color: var(--mu); padding: 12px 16px; border-bottom: 1px solid var(--bd); white-space: nowrap; }
table.t th.r, table.t td.r { text-align: right; }
table.t th button { border: 0; background: none; padding: 0; color: inherit; font: inherit; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
table.t th button:hover { color: var(--fg); }
table.t td { padding: 14px 16px; border-top: 1px solid var(--bd); font-size: 15px; vertical-align: middle; }
table.t tr:first-child td { border-top: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover td { background: var(--sf2); }
table.t tfoot td { border-top: 1px solid var(--fg); font-weight: 700; }
.mcards { display: none; }
.mcard { background: var(--sf); border: 1px solid var(--bd); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left; }
.mcard + .mcard { margin-top: 12px; }
.mcard .hd { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.mcard .t { font-size: 16px; font-weight: 600; }
.mcard .m { font-size: 14px; color: var(--mu); }

/* ── Argent ───────────────────────────────────────────────────────── */
.mstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.mstats .stat { background: var(--sf); border: 1px solid var(--bd); border-radius: 16px; padding: 24px; }
.mstats .v { font-size: clamp(32px, 5vw, 44px); font-weight: 600; letter-spacing: -.04em; line-height: 1.1; }
.sum-line { font-size: 14px; color: var(--mu); margin-top: 12px; display: flex; align-items: center; gap: 8px; }
.igrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; align-items: start; }
.igroup h3 { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.igroup .cnt { font-size: 14px; color: var(--mu); margin-bottom: 8px; }
.irow { padding: 14px 0; border-top: 1px solid var(--bd); display: flex; flex-direction: column; gap: 8px; }
.irow .hd { display: flex; justify-content: space-between; gap: 12px; }
.irow .t { font-size: 15px; font-weight: 600; }
.irow .m { font-size: 13px; color: var(--mu); }
.irow .ok { font-size: 13px; color: var(--grn-fg); font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }

/* ── Réglages ─────────────────────────────────────────────────────── */
.narrow { max-width: 720px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; color: var(--fg); }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--bd); border-radius: 12px; background: var(--sf);
  font-size: 16px; color: var(--fg); transition: border-color var(--ease);
}
textarea.input { padding: 12px 14px; min-height: 88px; resize: vertical; }
.input:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px rgba(56,189,248,.25); }
.fields { display: grid; gap: 16px; }
.conn { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-top: 1px solid var(--bd); flex-wrap: wrap; }
.conn:first-of-type { border-top: 0; }
.conn .rico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--sf2); font-size: 18px; flex: none; }
.conn .grow { flex: 1; min-width: 180px; }

/* ── États ────────────────────────────────────────────────────────── */
.empty { border: 1.5px dashed var(--bd); border-radius: 16px; padding: 40px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty .ic { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--sf2); color: var(--mu); font-size: 22px; }
.empty h3 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin: 0; }
.empty p { color: var(--mu); margin: 0; max-width: 420px; }
.error { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.error .ic { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--red-bg); color: var(--red-fg); font-size: 22px; }
.error h3 { font-size: 20px; margin: 0; }
.error p { color: var(--mu); margin: 0 0 8px; }
.sk { background: var(--sf2); border-radius: 12px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.demo-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 24px;
  border-radius: 12px; background: var(--org-bg); color: var(--org-fg); font-size: 14px; font-weight: 500;
}
.demo-banner button { margin-left: auto; min-height: 36px; padding: 0 14px; border-radius: 10px; border: 1.5px solid currentColor; background: none; color: inherit; font-size: 13px; font-weight: 600; }

/* ── Palette de commandes, feuille, toast ─────────────────────────── */
.overlay { position: fixed; inset: 0; z-index: 80; background: var(--overlay); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; animation: fade .2s var(--ease); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.cmd { width: 100%; max-width: 600px; background: var(--sf); border-radius: 12px; box-shadow: var(--sh-lg); overflow: hidden; animation: rise .2s var(--ease); border: 1px solid var(--bd); }
.cmd .q { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--bd); color: var(--mu); }
.cmd input { flex: 1; height: 60px; border: 0; background: none; font-size: 17px; color: var(--fg); outline: none; }
.cmd ul { list-style: none; margin: 0; padding: 8px; max-height: 60vh; overflow-y: auto; }
.cmd li { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: 10px; cursor: pointer; font-size: 15px; }
.cmd li[aria-selected="true"] { background: var(--sf2); }
.cmd li i { width: 20px; text-align: center; color: var(--mu); }
.cmd li .g { margin-left: auto; font-size: 13px; color: var(--mu); }
.cmd .none { padding: 24px; text-align: center; color: var(--mu); }

.sheet-wrap { align-items: center; padding: 24px; }
.sheet {
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; background: var(--sf); border-radius: 16px;
  box-shadow: var(--sh-lg); padding: 24px; animation: rise .2s var(--ease); border: 1px solid var(--bd);
}
.sheet .grab { display: none; }
.sheet .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.sheet .hd h2 { flex: 1; font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin: 0; }
.qitem { width: 100%; display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 8px 12px; border: 0; border-radius: 12px; background: none; text-align: left; }
.qitem:hover { background: var(--sf2); }
.qitem .rico { width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--sf2); font-size: 17px; }
.qitem:hover .rico { background: var(--sf); }
.qitem .t { font-size: 15px; font-weight: 600; }
.qitem .m { font-size: 13px; color: var(--mu); }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 90; transform: translateX(-50%); max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 18px; border-radius: 12px;
  background: var(--pri); color: var(--pri-fg); box-shadow: var(--sh-lg); font-size: 15px; font-weight: 500; animation: toastin .2s var(--ease);
}
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px); } }
.toast button { min-height: 36px; padding: 0 12px; border-radius: 8px; border: 0; background: none; color: var(--acc); font-size: 14px; font-weight: 700; }

/* ── Tablette : barre latérale en icônes ──────────────────────────── */
@media (max-width: 1023px) {
  .top { padding: 0 28px; }
  .main { padding: 28px 28px 64px; }
}

/* ── Téléphone ────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .side, .top { display: none; }
  .mtop {
    display: flex; position: sticky; top: 0; z-index: 30; height: 56px; align-items: center; gap: 4px; padding: 0 8px 0 16px;
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--bd); padding-top: env(safe-area-inset-top);
  }
  .mtop .title { flex: 1; min-width: 0; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mtop .back { margin-left: -8px; }
  .tband {
    display: flex; position: sticky; top: 56px; z-index: 29; align-items: center; gap: 10px; padding: 8px 16px;
    background: var(--sf2); font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--bd);
  }
  .tband .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red-fg); animation: pulse 1.4s infinite; }
  .tband .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tband button { min-height: 36px; padding: 0 14px; border-radius: 10px; border: 0; background: var(--pri); color: var(--pri-fg); font-size: 13px; font-weight: 600; }
  .tband[hidden] { display: none; }
  .main { padding: 20px 16px 120px; }
  .bottom {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--bd);
  }
  .bottom button {
    position: relative; border: 0; background: none; color: var(--mu); min-height: 56px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 600;
  }
  .bottom button i { font-size: 19px; }
  .bottom button[aria-current="page"] { color: var(--fg); }
  .bottom button[aria-current="page"]::before {
    content: ""; position: absolute; top: -6px; left: 50%; width: 24px; height: 3px; margin-left: -12px; border-radius: 0 0 3px 3px; background: var(--acc);
  }
  .bottom .plus { align-self: center; justify-self: center; width: 56px; height: 56px; min-height: 56px; border-radius: 16px; background: var(--pri); color: var(--pri-fg); }
  .bottom .plus i { font-size: 22px; }
  .bottom .badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--red-fg); color: var(--bg); font-size: 11px; line-height: 18px; text-align: center; }
  .tabs { top: 56px; margin: 0 -16px; padding: 0 8px; }
  .tband:not([hidden]) ~ .main .tabs { top: 108px; }
  .pstats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .pstats .stat .v { font-size: 20px; }
  .band .stat .v { font-size: 24px; }
  .dt { display: none; }
  .mcards { display: block; }
  .sheet-wrap { align-items: flex-end; padding: 0; }
  .sheet { max-width: none; border-radius: 24px 24px 0 0; padding: 8px 20px calc(24px + env(safe-area-inset-bottom)); max-height: 90dvh; border: 0; }
  .sheet .grab { display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--bd); margin: 4px auto 12px; }
  .overlay { padding-top: 8vh; }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
  h1.h1 { font-size: 30px; }
}
/* Fenêtre modale centrée (fiche client) : en-tête, onglets, contenu qui défile. */
.modal-wrap { align-items: center; padding: 24px; }
.modal {
  width: 100%; max-width: 920px; height: min(88vh, 860px); display: flex; flex-direction: column;
  background: var(--sf); border: 1px solid var(--bd); border-radius: 16px; box-shadow: var(--sh-lg); animation: rise .2s var(--ease); overflow: hidden;
}
.modal-tete { display: flex; gap: 16px; align-items: flex-start; padding: 24px 24px 12px; }
.modal-tete h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.modal-tete .m { font-size: 14px; color: var(--mu); margin-top: 2px; }
.modal-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.modal-onglets { position: static; padding: 0 16px; margin: 0; flex: none; }
.modal-corps { flex: 1; overflow-y: auto; padding: 24px; }
.modal-pied { flex: none; padding: 10px 24px; border-top: 1px solid var(--bd); font-size: 13px; }
.h3 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.lien-fiche { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: inherit; text-align: left; }
.lien-fiche:hover { text-decoration: underline; text-underline-offset: 3px; }
.cuves { display: inline-flex; flex-wrap: wrap; gap: 6px 14px; justify-content: flex-end; }
.cuve-l { display: inline-flex; align-items: center; gap: 6px; }
.cuve { position: relative; width: 8px; height: 22px; border-radius: 2px; background: var(--sf2); overflow: hidden; flex: none; }
.cuve i { position: absolute; left: 0; right: 0; bottom: 0; }
.cuve.basse { outline: 1.5px solid var(--red-fg); outline-offset: 1px; }
@media (max-width: 767px) {
  .modal-wrap { padding: 0; align-items: stretch; }
  .modal { max-width: none; height: 100dvh; border-radius: 0; border: 0; }
  .modal-tete { padding: calc(16px + env(safe-area-inset-top)) 16px 8px; flex-wrap: wrap; }
  .modal-tete h2 { font-size: 20px; }
  .modal-onglets { padding: 0 8px; }
  .modal-corps { padding: 16px; }
  .modal-pied { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
}

/* La porte : connexion avant d'afficher quoi que ce soit. */
#porte { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.porte-carte { width: 100%; max-width: 400px; background: var(--sf); border: 1px solid var(--bd); border-radius: 16px; padding: 32px; }
.porte-carte .logo-mark { width: 44px; height: 44px; font-size: 20px; border-radius: 12px; }
body.a-la-porte .shell, body.a-la-porte .bottom { display: none !important; }

/* Un ajout entre en glissant, sans redessiner l'écran. */
.entree { animation: entree .28s var(--ease) both; }
@keyframes entree { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
