:root {
  /* Charte Copiafax */
  --brand-blue: #2E6AB6;
  --brand-blue-dark: #234f89;
  --brand-blue-light: #3C7DCB;
  --brand-orange: #EC9D3E;
  --brand-orange-dark: #d9852a;

  --bg: #eef2f7;
  --bg-alt: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f3f6fa;
  --border: #e4e9f0;
  --text: #1f2a37;
  --text-dim: #64748b;

  --primary: var(--brand-blue);
  --primary-dark: var(--brand-blue-dark);
  --accent: var(--brand-orange);
  --green: #16a34a;
  --red: #dc2626;
  --blue: #2E6AB6;

  --radius: 14px;
  --shadow: 0 6px 24px rgba(35,79,137,.10);
  --shadow-lg: 0 12px 40px rgba(35,79,137,.18);

  --map-bg: #e7eef7;
  --map-land: #cadcef;
  --map-stroke: #9cb9dd;
}

/* ── Thème sombre ── */
:root[data-theme="dark"] {
  --bg: #0f1720;
  --bg-alt: #141d28;
  --surface: #18222f;
  --surface-2: #1f2b3a;
  --border: #2a3746;
  --text: #e6edf3;
  --text-dim: #93a4b5;
  --map-bg: #0e1620;
  --map-land: #24303f;
  --map-stroke: #3a4b5e;
  --shadow: 0 6px 24px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
}
:root[data-theme="dark"] .page-title { color: var(--brand-blue-light); }
:root[data-theme="dark"] .kpi-value { color: #cfe1f7; }
:root[data-theme="dark"] .total-line.strong,
:root[data-theme="dark"] .tranche-head { color: var(--brand-blue-light); }
:root[data-theme="dark"] .link-chip { background: rgba(60,125,203,.16); color: #b7d3f2; border-color: rgba(60,125,203,.3); }

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--brand-blue); }

/* ════════════════ Login — scène nocturne animée ════════════════ */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative; overflow: hidden;
  background:
    radial-gradient(1200px 600px at 78% -10%, rgba(60,125,203,.32), transparent 60%),
    radial-gradient(900px 520px at 8% 110%, rgba(236,157,62,.16), transparent 60%),
    linear-gradient(160deg, #0d1b33 0%, #12264a 45%, #0a1526 100%);
}
/* Orbes lumineux (parallaxe souris via --px/--py) */
.lg-orbs { position: absolute; inset: 0; pointer-events: none; transform: translate(calc(var(--px, 0) * 26px), calc(var(--py, 0) * 26px)); transition: transform .25s ease-out; }
.lg-orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; }
.lg-orb.o1 { width: 440px; height: 440px; left: -120px; top: -140px; background: radial-gradient(circle, #3c7dcb, transparent 70%); animation: orbFloat 16s ease-in-out infinite; }
.lg-orb.o2 { width: 380px; height: 380px; right: -90px; top: 18%; background: radial-gradient(circle, rgba(236,157,62,.85), transparent 70%); animation: orbFloat 21s ease-in-out infinite reverse; }
.lg-orb.o3 { width: 300px; height: 300px; left: 34%; bottom: -120px; background: radial-gradient(circle, #2E6AB6, transparent 70%); animation: orbFloat 26s ease-in-out infinite; }
@keyframes orbFloat { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(40px,-30px) scale(1.08); } }
/* Grille perspective façon plan de chantier */
.lg-grid {
  position: absolute; left: -20%; right: -20%; bottom: -40px; height: 46vh; pointer-events: none; opacity: .16;
  background:
    repeating-linear-gradient(90deg, rgba(120,170,230,.9) 0 1px, transparent 1px 70px),
    repeating-linear-gradient(0deg, rgba(120,170,230,.9) 0 1px, transparent 1px 52px);
  transform: perspective(520px) rotateX(62deg);
  mask-image: linear-gradient(to top, rgba(0,0,0,.9), transparent 85%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,.9), transparent 85%);
}
/* Particules montantes */
.lg-particles { position: absolute; inset: 0; pointer-events: none; }
.lg-particles span {
  position: absolute; bottom: -8px; border-radius: 50%; background: rgba(190,215,245,.8);
  animation: lpRise linear infinite;
}
.lg-particles span.or { background: rgba(236,157,62,.85); box-shadow: 0 0 8px rgba(236,157,62,.7); }
@keyframes lpRise {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  8%   { opacity: .9; }
  60%  { opacity: .55; }
  100% { transform: translateY(-105vh) translateX(24px); opacity: 0; }
}
/* Carte d'Afrique — les 4 filiales reliées au siège RCA */
.lg-africa {
  position: absolute; left: 31%; top: 76%; height: min(90vh, 760px); aspect-ratio: 500 / 560;
  transform: translate(-50%, -50%) translate(calc(var(--px, 0) * -14px), calc(var(--py, 0) * -14px));
  pointer-events: none; transition: transform .3s ease-out; overflow: visible;
}
@media (max-width: 940px) {
  .lg-africa { left: 50%; top: 62%; height: 74vh; opacity: .5; }
  .af-pin text { display: none; }
}
.af-land {
  fill: rgba(46,106,182,.10); stroke: rgba(130,180,240,.38); stroke-width: 1.5;
  filter: drop-shadow(0 0 22px rgba(60,125,203,.35));
  animation: afBreath 9s ease-in-out infinite;
}
@keyframes afBreath { 0%,100% { fill: rgba(46,106,182,.10); } 50% { fill: rgba(46,106,182,.17); } }
.af-link {
  fill: none; stroke: rgba(236,157,62,.8); stroke-width: 1.7; stroke-linecap: round;
  stroke-dasharray: 5 8; animation: afFlow 2.4s linear infinite;
  filter: drop-shadow(0 0 5px rgba(236,157,62,.55));
}
.af-link:nth-of-type(2) { animation-delay: .5s; }
.af-link:nth-of-type(3) { animation-delay: 1s; }
@keyframes afFlow { to { stroke-dashoffset: -26; } }
.af-pin .dot { fill: #EC9D3E; filter: drop-shadow(0 0 9px rgba(236,157,62,.95)); }
.af-pin.hub .dot { fill: #f7c37e; }
.af-pin .ring {
  fill: none; stroke: #EC9D3E; stroke-width: 1.6; opacity: .85;
  transform-box: fill-box; transform-origin: center; animation: afPulse 2.6s ease-out infinite;
}
.af-pin .ring.r2 { animation-delay: 1.3s; }
.af-pin.p2 .ring { animation-delay: .6s; }
.af-pin.p3 .ring { animation-delay: 1.1s; }
.af-pin.p4 .ring { animation-delay: 1.7s; }
@keyframes afPulse { 0% { transform: scale(.35); opacity: .95; } 100% { transform: scale(2.7); opacity: 0; } }
.af-pin text {
  fill: #dbe8f7; font-size: 13.5px; font-weight: 700; letter-spacing: .06em;
  paint-order: stroke; stroke: rgba(8,16,32,.85); stroke-width: 3.5px;
}
.af-pin.hub text { fill: #f7c37e; font-size: 14.5px; }

/* Scène deux colonnes */
.login-stage { position: relative; z-index: 2; display: flex; align-items: center; gap: 64px; max-width: 1060px; width: 100%; justify-content: center; }
.lg-brand { flex: 1; max-width: 520px; color: #eaf2fc; margin-bottom: 26vh; }
.lg-brand-logo { height: 54px; margin-bottom: 26px; animation: lgUp .7s .05s cubic-bezier(.22,.9,.35,1) both; }
.lg-headline { font-size: clamp(30px, 3.6vw, 46px); line-height: 1.12; font-weight: 800; letter-spacing: -.01em; margin: 0 0 16px; animation: lgUp .7s .15s cubic-bezier(.22,.9,.35,1) both; }
.lg-headline span { background: linear-gradient(90deg, #EC9D3E, #f7c37e); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lg-tagline { color: rgba(214,230,248,.75); font-size: 15.5px; line-height: 1.6; margin: 0 0 22px; max-width: 440px; animation: lgUp .7s .25s cubic-bezier(.22,.9,.35,1) both; }
.lg-badges { display: flex; flex-wrap: wrap; gap: 10px; animation: lgUp .7s .35s cubic-bezier(.22,.9,.35,1) both; }
.lg-badges span {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.13); backdrop-filter: blur(8px);
  border-radius: 30px; padding: 8px 15px; font-size: 13px; color: #dbe8f7;
}
.lg-badges b { color: #EC9D3E; }
.lg-badges i { font-style: normal; }
@keyframes lgUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* Carte verre + halo tournant */
.lg-cardwrap { position: relative; animation: lgUp .8s .1s cubic-bezier(.22,.9,.35,1) both; }
.lg-cardwrap::before {
  content: ''; position: absolute; inset: -46px; border-radius: 40px; pointer-events: none; z-index: 0;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(60,125,203,.5) 70deg, rgba(236,157,62,.55) 150deg, transparent 220deg, rgba(60,125,203,.35) 300deg, transparent 360deg);
  filter: blur(34px); opacity: .8; animation: lgHalo 9s linear infinite;
}
@keyframes lgHalo { to { transform: rotate(360deg); } }
.login-card {
  position: relative; z-index: 1; width: 392px; max-width: calc(100vw - 40px);
  background: linear-gradient(165deg, rgba(23,42,74,.72), rgba(12,23,44,.82));
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255,255,255,.14); border-radius: 24px; padding: 32px 30px 22px;
  box-shadow: 0 30px 80px rgba(3,10,24,.6), inset 0 1px 0 rgba(255,255,255,.09);
  display: flex; flex-direction: column; gap: 14px;
}
.login-card > * { animation: lgUp .55s cubic-bezier(.22,.9,.35,1) both; }
.login-card > *:nth-child(1) { animation-delay: .18s; } .login-card > *:nth-child(2) { animation-delay: .24s; }
.login-card > *:nth-child(3) { animation-delay: .30s; } .login-card > *:nth-child(4) { animation-delay: .36s; }
.login-card > *:nth-child(5) { animation-delay: .42s; } .login-card > *:nth-child(6) { animation-delay: .48s; }
.login-card > *:nth-child(7) { animation-delay: .54s; } .login-card > *:nth-child(8) { animation-delay: .60s; }
.login-logo { height: 44px; margin: 2px auto 0; display: block; filter: drop-shadow(0 4px 18px rgba(60,125,203,.45)); }
.login-sub { text-align: center; color: rgba(198,218,240,.65); letter-spacing: .26em; text-transform: uppercase; font-size: 10.5px; margin-bottom: 4px; }
.lg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 10.5px; color: rgba(198,218,240,.62); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.lg-field { position: relative; }
.lg-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 15px; opacity: .85; pointer-events: none; }
.login-card input, .login-card select {
  width: 100%; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.13); color: #f2f7fd;
  border-radius: 13px; padding: 12px 14px 12px 40px; font: inherit; font-size: 14.5px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.login-card select { appearance: none; -webkit-appearance: none; cursor: pointer; }
.login-card select option { color: #1f2a37; background: #fff; }
.login-card input:focus, .login-card select:focus {
  outline: none; border-color: rgba(236,157,62,.85); background: rgba(255,255,255,.11);
  box-shadow: 0 0 0 3.5px rgba(236,157,62,.22), 0 0 24px rgba(236,157,62,.18);
}
.login-card input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px #16294a inset; -webkit-text-fill-color: #f2f7fd; }
.lg-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 16px; cursor: pointer; opacity: .7; padding: 6px; }
.lg-eye:hover { opacity: 1; }
.lg-submit {
  margin-top: 4px; position: relative; overflow: hidden; cursor: pointer;
  background: linear-gradient(120deg, #2E6AB6, #3c7dcb 55%, #2E6AB6); background-size: 200% 100%;
  color: #fff; border: none; border-radius: 14px; padding: 14px; font: inherit; font-weight: 800;
  font-size: 15px; letter-spacing: .06em; text-transform: uppercase;
  box-shadow: 0 12px 30px rgba(46,106,182,.45), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .15s, box-shadow .2s, background-position .4s;
}
.lg-submit:hover { background-position: 100% 0; transform: translateY(-2px); box-shadow: 0 16px 40px rgba(46,106,182,.6), 0 0 30px rgba(236,157,62,.25); }
.lg-submit:active { transform: scale(.97); }
.lg-submit::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 46%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent);
  transform: skewX(-20deg); animation: lgSheen 3.2s ease-in-out infinite;
}
@keyframes lgSheen { 0%, 55% { left: -60%; } 85%, 100% { left: 130%; } }
.login-error { color: #ff8f8f; font-size: 12.5px; min-height: 16px; text-align: center; font-weight: 600; }
.lg-foot { text-align: center; font-size: 11px; color: rgba(198,218,240,.45); margin-top: 2px; }
.lg-dev {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  margin-top: 9px; padding-top: 9px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: 11px; color: rgba(198,218,240,.55);
}
.lg-dev-name { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.lg-dev svg { height: 22px; width: 22px; flex: 0 0 22px; filter: drop-shadow(0 2px 6px rgba(142,43,212,.45)); }
.lg-dev b { color: #dbe8f7; font-weight: 700; }
.lg-dev a { color: rgba(236,157,62,.9); text-decoration: none; }
.lg-dev a:hover { text-decoration: underline; }

/* Déclinaison du logo par pays (sous le wordmark) */
.lg-country-brand { width: 136px; box-sizing: border-box; padding-right: 19px; margin: -8px auto 0; display: flex; justify-content: flex-end; position: relative; z-index: 1; }
.lg-country-brand .lk, .brand-country .lk { display: inline-flex; flex-direction: column; align-items: stretch; }
.lg-country-brand b { font-size: 10.5px; letter-spacing: .3em; font-weight: 800; text-transform: uppercase; color: #EC9D3E; line-height: 1; }
.lg-country-brand i { display: block; height: 3px; border-radius: 2px; margin-top: 2px; background: #EC9D3E; }
.brand-country { width: 100%; box-sizing: border-box; padding-right: 13.8%; margin: -16px 0 0; display: flex; justify-content: flex-end; position: relative; z-index: 1; }
.brand-country b { font-size: 9.5px; letter-spacing: .3em; font-weight: 800; text-transform: uppercase; line-height: 1; }
.brand-country i { display: block; height: 2.5px; border-radius: 2px; margin-top: 2px; }

/* Filigranes métier (immeuble, pont, route) */
.lg-wm {
  position: absolute; pointer-events: none; fill: none; stroke: #9cc4f0; stroke-width: 2;
  opacity: .15; stroke-linecap: round; stroke-linejoin: round;
  animation: wmFloat 16s ease-in-out infinite alternate;
}
.lg-wm .dash { stroke-dasharray: 10 12; }
.wm-imm { left: 1.5%; top: 4%; width: min(23vw, 330px); }
.wm-pont { left: 28%; top: 1%; width: min(40vw, 580px); animation-delay: 3s; }
.wm-route { right: 1.5%; bottom: 3%; width: min(28vw, 410px); animation-delay: 6s; }
@keyframes wmFloat { from { transform: translateY(0); } to { transform: translateY(10px); } }
@media (max-width: 940px) { .lg-wm { display: none; } }
@media (max-width: 940px) {
  .lg-brand { display: none; }
  .login-stage { gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .lg-orb, .lg-particles span, .af-land, .af-link, .af-pin .ring, .lg-wm,
  .lg-cardwrap::before, .lg-submit::after, .login-card > *, .lg-brand-logo, .lg-headline, .lg-tagline, .lg-badges, .lg-cardwrap { animation: none !important; }
}

/* ── Layout ── */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
  color: #fff; display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }
.sidebar-brand { display: flex; flex-direction: column; align-items: stretch; justify-content: center; padding: 14px 14px 10px; border-bottom: 1px solid rgba(255,255,255,.14); position: sticky; top: 0; background: var(--brand-blue); z-index: 1; }
.brand-chip { background: #fff; border-radius: 10px; padding: 8px 12px; display: flex; width: 100%; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.brand-logo { width: 100%; height: auto; max-width: 100%; display: block; }
#brand-name { font-weight: 800; font-size: 18px; color: #fff; }
.nav { padding: 8px; }
.nav-group { margin-bottom: 2px; }
.nav-group-title {
  display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none;
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: rgba(255,255,255,.62);
  padding: 12px 12px 6px; font-weight: 700;
}
.nav-group-title:hover { color: #fff; }
.nav-caret { transition: transform .18s; font-size: 10px; opacity: .8; }
.nav-group.collapsed .nav-caret { transform: rotate(-90deg); }
.nav-group.collapsed .nav-group-items { display: none; }
.nav-group-items { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; cursor: pointer; color: rgba(255,255,255,.9); font-size: 13.5px; border-left: 3px solid transparent; }
.nav-item:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 700; border-left-color: var(--brand-orange); }
.nav-item .ico { width: 26px; text-align: center; font-size: 18px; line-height: 1; flex: 0 0 26px; }
.nav-group-title .gico { display: inline-block; width: 24px; text-align: center; font-size: 17px; line-height: 1; margin-right: 7px; vertical-align: -2px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 24px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 3px rgba(35,79,137,.05); }
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.page-title { font-size: 19px; font-weight: 800; color: var(--brand-blue-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { font-size: 18px; padding: 6px 11px; line-height: 1; }
#menu-btn { display: none; }
.nav-scrim { display: none; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.country-switch { width: auto; padding: 6px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); max-width: 200px; }
@media (max-width: 640px) { .country-switch { max-width: 120px; } }
.user-badge { color: var(--text-dim); font-size: 13px; font-weight: 500; }
.view { padding: 24px; max-width: 1180px; }

/* ── Boutons ── */
.btn { border: 1px solid var(--border); background: #fff; color: var(--text); padding: 9px 15px; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600; transition: all .12s; }
.btn:hover { border-color: var(--brand-blue); color: var(--brand-blue); }
.btn-primary { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; }
.btn-primary:hover { background: var(--brand-blue-dark); border-color: var(--brand-blue-dark); color: #fff; }
.btn-accent { background: var(--brand-orange); border-color: var(--brand-orange); color: #fff; }
.btn-accent:hover { background: var(--brand-orange-dark); border-color: var(--brand-orange-dark); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--brand-blue); }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); color: var(--red); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 12px; }

input, select, textarea { background: #fff; border: 1px solid var(--border); color: var(--text); padding: 9px 12px; border-radius: 10px; font-size: 13px; font-family: inherit; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(46,106,182,.12); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--text-dim); font-weight: 600; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--text-dim); font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; }
tbody tr:hover { background: var(--surface-2); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-on { background: rgba(22,163,74,.13); color: var(--green); }
.badge-off { background: rgba(220,38,38,.12); color: var(--red); }
.badge-stub { background: rgba(100,116,139,.14); color: var(--text-dim); }
.badge-ready { background: rgba(236,157,62,.16); color: var(--brand-orange-dark); }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; cursor: pointer; transition: transform .1s, box-shadow .12s, border-color .12s; box-shadow: var(--shadow); }
.dash-card:hover { transform: translateY(-3px); border-color: var(--brand-blue); box-shadow: var(--shadow-lg); }
.dash-card .dc-ico { font-size: 26px; }
.dash-card .dc-label { font-weight: 700; margin-top: 8px; }
.dash-card .dc-group { color: var(--text-dim); font-size: 11px; margin-top: 4px; }
.dash-card .dc-kpi { font-size: 12px; margin-top: 6px; font-weight: 600; color: var(--brand-blue-dark); min-height: 16px; }
.domain-card { border-left: 3px solid var(--brand-blue); }
.domain-card:hover { border-left-color: var(--brand-orange); }
:root[data-theme="dark"] .dash-card .dc-kpi { color: #b7d3f2; }

.stub { text-align: center; color: var(--text-dim); padding: 60px 20px; }
.stub .stub-ico { font-size: 48px; }
.stub h2 { color: var(--text); margin: 12px 0 6px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--text-dim); }
.checkline { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.checkline input { width: auto; }
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--brand-blue-dark); color: #fff; border: none; padding: 13px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 50; font-weight: 600; }
.toast.err { background: var(--red); }

/* ── Boards ── */
.board-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.group-head { display: flex; align-items: center; gap: 9px; padding: 13px 18px; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.group-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-orange); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 7px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.link-chip { display: inline-block; padding: 2px 9px; border-radius: 7px; background: rgba(46,106,182,.08); border: 1px solid rgba(46,106,182,.18); color: var(--brand-blue-dark); font-size: 12px; font-weight: 600; }
.progress { position: relative; background: var(--surface-2); border-radius: 7px; height: 18px; min-width: 90px; overflow: hidden; border: 1px solid var(--border); }
.progress-bar { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--brand-blue-light), var(--brand-blue)); }
.progress-txt { position: relative; font-size: 11px; line-height: 18px; padding-left: 8px; font-weight: 600; }

/* ── Gantt ── */
.gantt { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.gantt-row { display: grid; grid-template-columns: 200px 1fr; align-items: center; gap: 10px; }
.gantt-label { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-track { position: relative; height: 24px; background: var(--surface-2); border-radius: 7px; }
.gantt-bar { position: absolute; top: 3px; bottom: 3px; border: 1px solid; border-radius: 6px; overflow: hidden; display: flex; align-items: center; }
.gantt-fill { position: absolute; left: 0; top: 0; bottom: 0; opacity: .55; }
.gantt-bar-txt { position: relative; font-size: 10px; padding-left: 6px; font-weight: 700; color: #fff; }
.gantt-scale { display: flex; justify-content: space-between; color: var(--text-dim); font-size: 11px; margin: 8px 0 0 210px; }

/* ── KPI ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.kpi-card.clickable { cursor: pointer; transition: transform .1s, box-shadow .12s; }
.kpi-card.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-ico { font-size: 22px; }
.kpi-value { font-size: 23px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; color: var(--brand-blue-dark); }
.kpi-label { color: var(--text-dim); font-size: 12px; margin-top: 4px; }

/* ── Barres ── */
.bar-row { display: grid; grid-template-columns: 200px 1fr auto; align-items: center; gap: 12px; padding: 6px 0; }
.bar-label { font-size: 12px; color: var(--text-dim); }
.bar-track { background: var(--surface-2); border-radius: 7px; height: 20px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 7px; min-width: 2px; }
.bar-val { font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }

/* ── Devis ── */
.tranche-head { font-weight: 800; font-size: 14px; margin: 16px 0 8px; color: var(--brand-blue); }
.lot-head { font-weight: 700; font-size: 13px; margin: 8px 0 4px; }
.devis-table input { padding: 5px 8px; }
.devis-table td { padding: 5px 8px; }
.totals { display: flex; flex-direction: column; gap: 4px; max-width: 400px; margin-left: auto; }
.total-line { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; border-bottom: 1px dashed var(--border); }
.total-line.strong { font-weight: 800; font-size: 15px; border-bottom: 2px solid var(--brand-blue); color: var(--brand-blue-dark); }

/* ── Fiche détaillée ── */
.id-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.id-item { display: flex; flex-direction: column; gap: 4px; }
.id-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); font-weight: 600; }
.scan-label { font-size: 12px; color: var(--text-dim); display: block; margin-bottom: 6px; font-weight: 600; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.photo-cell { position: relative; }
.photo-img { height: 110px; width: 150px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; background: var(--surface-2); }
.photo-del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.55); color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: 12px; }
.photo-del:hover { background: var(--red); }

/* ── Dashboard moderne ── */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: linear-gradient(120deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%); color: #fff; border-radius: 18px; padding: 24px 26px; margin-bottom: 18px; box-shadow: var(--shadow-lg); }
.hero-greet { font-size: 23px; font-weight: 800; }
.hero-sub { color: rgba(255,255,255,.82); margin-top: 4px; text-transform: capitalize; }
.section-title { font-size: 12.5px; font-weight: 800; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin: 24px 0 12px; }

/* ── Météo ── */
.weather-box { display: flex; align-items: center; gap: 14px; }
.weather-box.compact { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.2); border-radius: 14px; padding: 12px 18px; color: #fff; }
.weather-emoji { font-size: 40px; line-height: 1; }
.weather-temp { font-size: 26px; font-weight: 800; }
.weather-label { font-size: 13px; opacity: .9; }
.weather-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.weather-card h3 { margin-bottom: 12px; }
.weather-card .weather-box.compact { background: rgba(46,106,182,.08); border-color: rgba(46,106,182,.18); color: var(--text); }

/* ── Carte RCA ── */
.map-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.map-card { padding: 10px; }
.rca-map { width: 100%; height: auto; border-radius: 12px; display: block; }
.map-marker text { paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.map-side { display: flex; flex-direction: column; gap: 16px; }
.map-list-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px; border-radius: 10px; cursor: pointer; }
.map-list-item:hover { background: var(--surface-2); }
.map-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 3px; flex-shrink: 0; }

/* ── Stepper de validation ── */
.stepper { display: flex; align-items: flex-start; gap: 0; margin-top: 8px; flex-wrap: wrap; }
.step { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 120px; }
.step-dot { width: 42px; height: 42px; border-radius: 50%; border: 2px solid; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; background: #fff; }
.step-label { font-weight: 700; font-size: 13px; margin-top: 8px; }
.step-role { font-size: 11px; margin-top: 2px; }
.stepper-line { height: 3px; flex: 1; min-width: 30px; margin-top: 20px; border-radius: 2px; }

/* ── Contrôle budgétaire ── */
.budget-line { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; font-variant-numeric: tabular-nums; }

/* ── Notifications ── */
.notif-item { display: flex; gap: 12px; align-items: flex-start; padding: 13px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.lu { opacity: .55; }
.notif-ico { font-size: 18px; }
.notif-badge { width: 9px; height: 9px; border-radius: 50%; background: var(--brand-orange); margin-top: 6px; }

/* ── Cloche & volet d'alertes ── */
.alert-bell-wrap { position: relative; }
.alert-badge { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; border-radius: 999px; min-width: 18px; height: 18px; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.alert-dropdown { position: absolute; top: 46px; right: 0; width: 350px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 60; padding: 14px; }
.ad-head { font-weight: 800; margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; }
.ad-counts { display: flex; gap: 6px; flex-wrap: wrap; }
.ad-chip { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.ad-chip.red { background: rgba(220,38,38,.13); color: var(--red); }
.ad-chip.orange { background: rgba(236,157,62,.16); color: var(--brand-orange-dark); }
.ad-list { max-height: 340px; overflow-y: auto; margin-bottom: 10px; }
.ad-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 6px; border-radius: 9px; cursor: pointer; }
.ad-item:hover { background: var(--surface-2); }
.ad-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.ad-dot.red { background: var(--red); }
.ad-dot.orange { background: var(--brand-orange); }

/* ── Tableau de bord de groupe ── */
.group-hero { display: flex; align-items: center; gap: 18px; background: linear-gradient(120deg, var(--brand-blue), var(--brand-blue-dark)); color: #fff; border-radius: 16px; padding: 22px 26px; margin-bottom: 8px; box-shadow: var(--shadow-lg); }
.group-hero-ico { font-size: 40px; }
.group-hero-title { font-size: 22px; font-weight: 800; }
.group-hero-sub { opacity: .85; margin-top: 2px; }

/* ── Bons sécurisés ── */
.bon-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.bon-type-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 600; font-size: 13px; transition: all .12s; }
.bon-type-card:hover { border-color: var(--brand-blue); background: var(--surface-2); transform: translateY(-2px); }
.bon-detail { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }
.qr-card { text-align: center; }
.qr-box { background: #fff; border-radius: 12px; padding: 10px; display: inline-block; position: relative; }
.qr-box svg { width: 130px; height: 130px; display: block; }
.qr-logo { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 6px; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.secure-code { font-family: ui-monospace, monospace; font-weight: 800; letter-spacing: .2em; color: var(--brand-blue-dark); background: var(--surface-2); border-radius: 8px; padding: 8px; margin-top: 10px; font-size: 16px; }
@media (max-width: 760px) { .bon-detail { grid-template-columns: 1fr; } .bon-type-grid { grid-template-columns: 1fr; } }

/* ── Bons : impact / rapprochement / signatures ── */
.impact-note { margin-top: 14px; background: rgba(22,163,74,.1); color: var(--green); border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 600; }
.reconcile { margin-top: 10px; border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 600; }
.reconcile.ok { background: rgba(22,163,74,.1); color: var(--green); }
.reconcile.ko { background: rgba(236,157,62,.14); color: var(--brand-orange-dark); }
.sign-slot { border: 1px dashed var(--border); border-radius: 12px; padding: 14px; text-align: center; }
.sign-img { max-height: 70px; display: block; margin: 6px auto; }
.sign-pad { border: 2px dashed var(--border); border-radius: 10px; width: 100%; touch-action: none; background: #fff; margin-top: 6px; cursor: crosshair; }

.assistant-out { background: var(--surface-2); border-radius: 10px; padding: 14px 16px; margin-top: 10px; line-height: 1.7; font-size: 14px; }

/* ── Vue kanban ── */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.kb-col { flex: 0 0 250px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 8px; }
.kb-head { font-weight: 800; font-size: 12.5px; padding: 8px 10px 10px; border-radius: 8px 8px 0 0; }
.kb-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; box-shadow: 0 1px 4px rgba(35,79,137,.08); transition: transform .1s, box-shadow .12s; }
.kb-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kb-title { font-weight: 700; font-size: 13px; }
.kb-line { font-size: 11.5px; margin-top: 3px; }

/* ── Fichiers joints (GED) ── */
.file-chip { display: flex; align-items: center; gap: 8px; height: 110px; width: 150px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer; padding: 10px; flex-direction: column; justify-content: center; text-align: center; }
.file-chip:hover { border-color: var(--brand-blue); }
.file-ico { font-size: 30px; }
.file-name { font-size: 11px; font-weight: 600; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Recherche globale ── */
.global-search { position: relative; flex: 1; max-width: 420px; display: flex; align-items: center; }
.global-search .gs-ico { position: absolute; left: 12px; font-size: 13px; pointer-events: none; opacity: .7; }
.global-search input { padding-left: 34px; border-radius: 999px; background: var(--surface-2); }
.gs-results { position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 60; max-height: 60vh; overflow-y: auto; padding: 6px; }
.gs-item { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.gs-item:hover { background: var(--surface-2); }
.gs-item-ico { font-size: 17px; }
.gs-item-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-empty { padding: 14px; text-align: center; }

/* ── Bannière hors-ligne ── */
.offline-banner { background: var(--brand-orange); color: #3a2600; text-align: center; padding: 8px 14px; font-size: 13px; font-weight: 700; position: sticky; top: 0; z-index: 100; }

/* ── Responsive : tablettes & smartphones (Android / iOS / HarmonyOS) ── */
@media (max-width: 1100px) { .global-search { max-width: 260px; } }
@media (max-width: 860px) { .global-search { display: none; } }
@media (max-width: 1000px) { .map-layout { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  #menu-btn { display: inline-flex; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 274px; max-width: 84vw; z-index: 40; transform: translateX(-100%); transition: transform .22s ease; }
  .app.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .app.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(15,30,60,.45); z-index: 30; }
  .view { padding: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .hero-greet { font-size: 19px; }
  .gantt-row { grid-template-columns: 120px 1fr; }
  .bar-row { grid-template-columns: 120px 1fr auto; }
  .totals { max-width: none; }
}
@media (max-width: 480px) {
  .topbar { padding: 10px 14px; }
  .user-badge { display: none; }
  .page-title { font-size: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  th, td { padding: 9px 10px; font-size: 12px; }
}

/* ══════════════════════ Effets "wow" (motion design) ══════════════════════ */

/* Entrée de vue : les blocs montent en cascade */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.view-anim > * { animation: rise .38s cubic-bezier(.22,.9,.35,1) both; }
.view-anim > *:nth-child(2) { animation-delay: .05s; }
.view-anim > *:nth-child(3) { animation-delay: .10s; }
.view-anim > *:nth-child(4) { animation-delay: .15s; }
.view-anim > *:nth-child(5) { animation-delay: .20s; }
.view-anim > *:nth-child(n+6) { animation-delay: .24s; }

/* Cartes du tableau de bord : cascade interne */
.view-anim .dash-grid .dash-card, .view-anim .kpi-grid .kpi-card { animation: rise .4s cubic-bezier(.22,.9,.35,1) both; }
.view-anim .dash-grid .dash-card:nth-child(1), .view-anim .kpi-grid .kpi-card:nth-child(1) { animation-delay: .05s; }
.view-anim .dash-grid .dash-card:nth-child(2), .view-anim .kpi-grid .kpi-card:nth-child(2) { animation-delay: .10s; }
.view-anim .dash-grid .dash-card:nth-child(3), .view-anim .kpi-grid .kpi-card:nth-child(3) { animation-delay: .15s; }
.view-anim .dash-grid .dash-card:nth-child(4), .view-anim .kpi-grid .kpi-card:nth-child(4) { animation-delay: .20s; }
.view-anim .dash-grid .dash-card:nth-child(n+5) { animation-delay: .25s; }

/* Hero : dégradé vivant + halo orange */
@keyframes heroShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.hero, .group-hero {
  background: linear-gradient(120deg, var(--brand-blue) 0%, var(--brand-blue-dark) 45%, #1a3a66 70%, var(--brand-blue) 100%);
  background-size: 220% 220%;
  animation: heroShift 14s ease infinite;
  position: relative; overflow: hidden;
}
.hero::after, .group-hero::after {
  content: ''; position: absolute; top: -60px; right: -60px; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(236,157,62,.35) 0%, transparent 70%); pointer-events: none;
}

@keyframes cardIn { from { opacity: 0; transform: translateY(22px) scale(.97); } to { opacity: 1; transform: none; } }

/* Boutons : press + shine du primaire */
.btn { transition: all .14s cubic-bezier(.22,.9,.35,1); }
.btn:active { transform: scale(.96); }
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: ''; position: absolute; top: 0; left: -80%; width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-20deg); transition: left .45s ease; pointer-events: none;
}
.btn-primary:hover::after { left: 130%; }

/* Sidebar : glissement des items + logo au survol */
.nav-item { transition: background .15s, border-color .15s, transform .15s, color .15s; }
.nav-item:hover { transform: translateX(3px); }
.nav-item.active { box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.brand-logo { transition: transform .25s cubic-bezier(.22,.9,.35,1); }
.sidebar-brand:hover .brand-logo { transform: scale(1.04); }
.nav-group-items { overflow: hidden; }

/* Tables : survol fluide */
tbody tr { transition: background .12s; }

/* Pastilles & badges : petit pop au chargement */
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.view-anim .pill, .view-anim .badge { animation: pop .3s ease both; }

/* KPI : valeur qui glisse + survol lumineux */
.kpi-card { position: relative; overflow: hidden; }
.kpi-card::before {
  content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity .2s;
  background: radial-gradient(420px circle at 20% 0%, rgba(46,106,182,.07), transparent 60%);
}
.kpi-card:hover::before { opacity: 1; }

/* Toast : glisse depuis la droite */
@keyframes toastIn { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
.toast { animation: toastIn .3s cubic-bezier(.22,.9,.35,1) both; }

/* Dropdowns (alertes, recherche) : apparition douce */
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.alert-dropdown, .gs-results { animation: dropIn .22s ease both; }

/* Overlays (dialogues) */
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
body > div[style*="position:fixed"] { animation: overlayIn .18s ease both; }

/* Scrollbar du contenu principal */
.main ::-webkit-scrollbar, .view::-webkit-scrollbar { width: 10px; height: 10px; }
.main ::-webkit-scrollbar-thumb, .view::-webkit-scrollbar-thumb { background: rgba(46,106,182,.25); border-radius: 6px; }
.main ::-webkit-scrollbar-thumb:hover { background: rgba(46,106,182,.45); }

/* Focus visible cohérent (accessibilité) */
.btn:focus-visible, input:focus-visible, select:focus-visible, .nav-item:focus-visible {
  outline: 2px solid var(--brand-orange); outline-offset: 2px;
}

/* Accessibilité : réduire les animations si demandé */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  .sidebar, .topbar, .toolbar, .btn, .nav-scrim { display: none !important; }
  .app { grid-template-columns: 1fr; }
  body { background: #fff; }
  .card { border-color: #ccc; box-shadow: none; }
  .view-anim > *, .view-anim .dash-card, .view-anim .kpi-card { animation: none !important; }
}

/* ════════════════ Messagerie (chat, audio, vidéo) ════════════════ */
.chat-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 14px; height: calc(100vh - 150px); min-height: 460px; }
.chat-side { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; }
.chat-side-head { padding: 14px 16px; font-weight: 800; font-size: 15px; border-bottom: 1px solid var(--border); }
.chat-side-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #8aa0b8; padding: 12px 16px 5px; font-weight: 700; }
.chat-chan-list { overflow-y: auto; flex: 1; }
.chat-chan { display: flex; align-items: center; gap: 11px; padding: 9px 14px; cursor: pointer; border-left: 3px solid transparent; }
.chat-chan:hover { background: var(--surface-2); }
.chat-chan.active { background: var(--surface-2); border-left-color: var(--brand-blue); }
.chat-chan-txt { min-width: 0; flex: 1; }
.chat-chan-name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-chan-sub { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-avatar { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; position: relative; }
.chat-avatar.team { background: linear-gradient(135deg, var(--brand-orange), #d97b1e); }
.chat-avatar.online::after { content: ''; position: absolute; right: 0; bottom: 1px; width: 11px; height: 11px; border-radius: 50%; background: var(--green); border: 2px solid var(--surface); }
.chat-incall { position: absolute; top: -4px; right: -4px; font-size: 12px; }
/* Conversation */
.chat-main { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-head-id { display: flex; align-items: center; gap: 11px; }
.chat-head-name { font-weight: 800; font-size: 15px; }
.chat-head-sub { font-size: 12px; }
.chat-head-actions { display: flex; gap: 6px; }
.chat-head-actions .icon-btn { font-size: 19px; }
.chat-thread { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: linear-gradient(180deg, rgba(46,106,182,.03), transparent 120px); }
.msg-row { display: flex; }
.msg-row.mine { justify-content: flex-end; }
.msg-bubble { max-width: 72%; padding: 8px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); position: relative; }
.msg-row.mine .msg-bubble { background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark)); color: #fff; border: none; border-bottom-right-radius: 4px; }
.msg-row.theirs .msg-bubble { border-bottom-left-radius: 4px; }
.msg-bubble.call { background: rgba(236,157,62,.14); border: 1px dashed var(--brand-orange); color: var(--text); font-weight: 600; }
.msg-author { font-size: 11px; font-weight: 800; color: var(--brand-blue); margin-bottom: 2px; }
.msg-text { font-size: 13.5px; line-height: 1.45; word-break: break-word; }
.msg-time { font-size: 10px; opacity: .6; text-align: right; margin-top: 3px; }
.msg-audio { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.msg-audio audio { height: 34px; max-width: 220px; }
.msg-system { align-self: center; font-size: 11.5px; color: #8aa0b8; background: var(--surface-2); padding: 3px 12px; border-radius: 20px; }
/* Composer */
.chat-composer { display: flex; align-items: flex-end; gap: 8px; padding: 11px 14px; border-top: 1px solid var(--border); }
.chat-input { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 12px; padding: 9px 13px; font: inherit; font-size: 13.5px; background: var(--surface-2); color: var(--text); max-height: 120px; }
.chat-input:focus { outline: none; border-color: var(--brand-blue); }
.chat-send { border-radius: 50%; width: 40px; height: 40px; padding: 0; font-size: 16px; }
#chat-rec.recording { background: var(--red); color: #fff; animation: recPulse 1s infinite; }
@keyframes recPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); } 50% { box-shadow: 0 0 0 7px rgba(220,38,38,0); } }
/* Sonnerie d'appel entrant */
.call-ring { position: fixed; inset: 0; z-index: 3000; background: rgba(12,22,38,.82); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; }
.call-ring-box { background: var(--surface); border-radius: 22px; padding: 34px 40px; text-align: center; box-shadow: 0 24px 70px rgba(0,0,0,.4); }
.call-ring-ava { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 16px; background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 800; }
.call-ring-ava.big { width: 130px; height: 130px; font-size: 44px; }
.pulse { animation: ringPulse 1.4s infinite; }
@keyframes ringPulse { 0% { box-shadow: 0 0 0 0 rgba(46,106,182,.5); } 70% { box-shadow: 0 0 0 24px rgba(46,106,182,0); } 100% { box-shadow: 0 0 0 0 rgba(46,106,182,0); } }
.call-ring-name { font-size: 21px; font-weight: 800; }
.call-ring-sub { color: #8aa0b8; margin-top: 4px; }
.call-ring-actions { display: flex; gap: 30px; justify-content: center; margin-top: 26px; }
.call-btn { width: 60px; height: 60px; border-radius: 50%; border: none; font-size: 24px; cursor: pointer; color: #fff; display: flex; align-items: center; justify-content: center; transition: transform .12s; }
.call-btn:hover { transform: scale(1.08); }
.call-btn.accept { background: var(--green); }
.call-btn.decline, .call-btn.hangup { background: var(--red); }
.call-btn.mute, .call-btn.cam { background: #475569; }
.call-btn.mute.off, .call-btn.cam.off { background: var(--brand-orange); }
/* Overlay d'appel actif */
.call-overlay { position: fixed; inset: 0; z-index: 3000; background: #0b1626; display: flex; align-items: center; justify-content: center; }
.call-stage { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.call-remote-video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.call-local-video { position: absolute; right: 18px; top: 18px; width: 190px; max-width: 34vw; border-radius: 12px; border: 2px solid rgba(255,255,255,.5); background: #000; object-fit: cover; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.call-audio-face { text-align: center; color: #fff; }
.call-audio-name { font-size: 22px; font-weight: 800; margin-top: 14px; }
.call-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 26px calc(20px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 14px; background: linear-gradient(0deg, rgba(0,0,0,.7), transparent); }
.call-meta { color: #fff; }
.call-peer { font-weight: 800; font-size: 17px; }
.call-status-row { display: flex; gap: 10px; align-items: center; color: #cbd5e1; font-size: 13px; margin-top: 2px; }
.call-timer { font-variant-numeric: tabular-nums; }
.call-controls { display: flex; gap: 16px; }
.call-stage.connected .call-audio-face .pulse { animation: none; }
@media (max-width: 720px) {
  .chat-wrap { grid-template-columns: 1fr; height: auto; }
  .chat-side { max-height: 220px; }
  .chat-main { min-height: 60vh; }
}
:root[data-theme="dark"] .chat-avatar.online::after { border-color: var(--surface); }

/* ── Sélecteur segmenté (générateur de rapports) ── */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.seg-btn { border: none; background: transparent; color: var(--text); font: inherit; font-size: 13px; font-weight: 600; padding: 7px 13px; border-radius: 9px; cursor: pointer; }
.seg-btn:hover { background: rgba(46,106,182,.1); }
.seg-btn.active { background: var(--brand-blue); color: #fff; box-shadow: 0 2px 8px rgba(46,106,182,.35); }
#report-preview .board-card { margin-top: 12px; }

/* ════════════════ Cartographie : vignettes & détail chantier ════════════════ */
.ch-vignettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 8px; }
.ch-vignette { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; cursor: pointer; box-shadow: 0 1px 4px rgba(35,79,137,.06); transition: transform .12s, box-shadow .14s; }
.ch-vignette:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.ch-vig-photo { flex: 0 0 96px; background: var(--surface-2) center/cover no-repeat; display: flex; align-items: center; justify-content: center; }
.ch-vig-photo.has-img { background-size: cover; }
.ch-vig-ph { width: 54px; height: 54px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.ch-vig-body { flex: 1; padding: 11px 13px; min-width: 0; }
.ch-vig-head { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.ch-progress { height: 8px; border-radius: 5px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.ch-progress.sm { height: 6px; margin-top: 6px; }
.ch-progress-fill { height: 100%; border-radius: 5px; }
/* Hero détail chantier */
.ch-hero { display: flex; gap: 20px; flex-wrap: wrap; background: linear-gradient(135deg, rgba(46,106,182,.08), rgba(236,157,62,.06)); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px; margin-bottom: 14px; }
.ch-hero-title { font-size: 22px; font-weight: 800; color: var(--brand-blue-dark); }
.ch-hero-sub { font-size: 13px; margin-top: 2px; }
.ch-hero-facts { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 10px 18px; }
.ch-fact { display: flex; align-items: center; gap: 8px; }
.ch-fact-ico { font-size: 18px; }
.ch-fact-l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.ch-fact-v { font-weight: 700; font-size: 13px; }
.ch-diff-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.ch-flags { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }
.ch-flag { background: rgba(220,38,38,.1); color: #b91c1c; border: 1px solid rgba(220,38,38,.25); border-radius: 20px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; }
.ch-flag.ok { background: rgba(22,163,74,.1); color: #15803d; border-color: rgba(22,163,74,.25); }
.note-inline { margin: 6px 0; }
:root[data-theme="dark"] .ch-hero-title { color: var(--brand-blue-light); }
:root[data-theme="dark"] .ch-flag { color: #fca5a5; }

/* ════════════════ Bouton chat flottant (tous appareils) ════════════════ */
.chat-fab {
  position: fixed; right: 22px; bottom: 22px; right: max(22px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer; z-index: 2500;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark)); color: #fff; font-size: 26px;
  box-shadow: 0 8px 24px rgba(35,79,137,.45); display: flex; align-items: center; justify-content: center;
  transition: transform .14s, box-shadow .14s;
}
.chat-fab:hover { transform: scale(1.08); box-shadow: 0 12px 30px rgba(35,79,137,.55); }
.chat-fab:active { transform: scale(.96); }
@media (max-width: 720px) { .chat-fab { width: 52px; height: 52px; font-size: 23px; right: 16px; bottom: 16px; } }
@media print { .chat-fab { display: none; } }

/* ════════════════ Suivi chantier — cartes d'identité ════════════════ */
.ch-idcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; margin-top: 8px; }
.ch-idcard { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; cursor: pointer; box-shadow: 0 1px 4px rgba(35,79,137,.06); transition: transform .12s, box-shadow .14s; }
.ch-idcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.ch-idcard-band { flex: 0 0 6px; }
.ch-idcard-body { flex: 1; padding: 14px 16px; min-width: 0; }
.ch-idcard-head { display: flex; align-items: center; gap: 8px; }
.ch-idcard-code { font-size: 11px; font-weight: 800; color: var(--brand-blue); letter-spacing: .04em; }
.ch-idcard-title { font-size: 16px; font-weight: 800; margin: 4px 0 10px; }
.ch-idcard-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 12.5px; }
.ch-idcard-facts > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Chat : message fichier + partage pièce jointe ── */
.msg-file { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; font-size: 13px; font-weight: 600; padding: 4px 2px; }
.msg-row.mine .msg-file { color: #fff; }
.msg-file-ico { font-size: 22px; }
.photo-share { position: absolute; left: 4px; top: 4px; background: rgba(46,106,182,.9); color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: 11px; line-height: 1; }
.photo-cell { position: relative; }
