/* START ON CRM — thème « Made in Shadows » */
:root {
  --bg: #050507; --panel: #0B0C10; --panel2: #0E1015; --side: #07080B;
  --line: rgba(255,255,255,.07); --line2: rgba(255,255,255,.12);
  --text: #EDEFF3; --soft: #C9CED8; --muted: #8A90A0; --dim: #5F6574;
  --accent: #D4FF3A; --accent2: #3DE8FF; --danger: #FF4D6A; --warn: #FFB23D; --ok: #4BFF8A;
  --r: 14px;
  --f-disp: 'Anton', Impact, 'Arial Narrow', sans-serif;
  --f-body: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
body.has-grid .page { background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px); background-size: 40px 40px; }
a { color: var(--text); text-decoration: none; }
a:hover { color: #fff; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 99; background: var(--accent); color: #050507; padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

.mono { font-family: var(--f-mono); }
.disp { font-family: var(--f-disp); font-weight: 400; letter-spacing: .01em; text-transform: uppercase; line-height: .92; }
.lbl { font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.lbl.acc, .acc { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(var(--min, 300px), 100%), 1fr)); gap: 16px; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.cols > .main-col { flex: 999 1 560px; min-width: 0; }
.cols > .side-col { flex: 1 1 320px; min-width: 0; }

/* ---------- Structure ---------- */
.app { display: flex; min-height: 100vh; }
.side { width: 264px; flex: none; background: var(--side); border-right: 1px solid rgba(255,255,255,.06); padding: 22px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; }
.brandmark { display: flex; flex-direction: column; gap: 8px; padding: 0 8px; }
.brandmark img { width: 160px; height: auto; display: block; }
.brandmark span { font-size: 10px; letter-spacing: .16em; color: var(--muted); }
.navsec { display: flex; flex-direction: column; gap: 1px; margin-bottom: 12px; }
.navsec .lbl { font-size: 10px; padding: 0 12px 4px; }
.nv { display: flex; align-items: center; gap: 11px; padding: 7px 12px; min-height: 36px; border-radius: 9px; color: #A3A9B8; font-size: 13.5px; font-weight: 500; }
.nv svg { flex: none; opacity: .8; }
.nv:hover { background: rgba(255,255,255,.04); color: #fff; }
.nv.on { background: var(--accent-soft); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.nv.on svg { color: var(--accent); opacity: 1; }
.nv span:not(.ct):not(.lk) { flex: 1; }
.ct { margin-left: auto; font: 700 11px var(--f-mono); color: #050507; background: var(--accent); padding: 1px 6px; border-radius: 5px; }
.ct2 { background: var(--accent2); }
.lk { margin-left: auto; font: 9.5px var(--f-mono); letter-spacing: .08em; color: var(--muted); border: 1px solid var(--line2); padding: 1px 5px; border-radius: 4px; }
.side-online { display: flex; flex-direction: column; gap: 8px; padding: 0 8px; }
.side-online .who { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.side-online .who small { display: block; font: 10.5px var(--f-mono); color: var(--muted); }
.me-card { margin-top: auto; padding: 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.me-card b { display: block; font-size: 13px; }
.me-card span.mono { display: block; font-size: 10px; color: var(--accent); letter-spacing: .06em; }
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 14px; padding: 16px 32px; border-bottom: 1px solid rgba(255,255,255,.05); position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); }
.search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 12px; background: var(--panel); border: 1px solid rgba(255,255,255,.08); color: var(--muted); max-width: 640px; }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); }
.search kbd { font-size: 11px; border: 1px solid var(--line2); padding: 2px 7px; border-radius: 6px; }
.coords { font-size: 10.5px; letter-spacing: .08em; color: var(--muted); line-height: 1.45; text-align: right; margin-left: auto; }
.coords span { color: var(--text); }
.page { flex: 1; padding: 26px 32px 60px; display: flex; flex-direction: column; gap: 22px; }
.top .menu-btn { display: none; }
.ph { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.ph h1 { margin: 6px 0 0; font-size: clamp(44px, 5.4vw, 84px); }
.ph-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Composants ---------- */
.card { background: linear-gradient(180deg, var(--panel2) 0%, #0A0B0F 100%); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; position: relative; }
.card.glow { border-color: var(--accent-line); box-shadow: var(--glow); }
.card h2 { margin: 0; font-size: 15px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.kpi .disp { font-size: 48px; margin-top: 10px; }
.kpi .sub { font: 12px var(--f-mono); color: var(--muted); margin-top: 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,.1); background: var(--panel); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: rgba(255,255,255,.25); color: #fff; }
.btn.primary { background: var(--accent); color: #050507; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); color: #050507; }
.btn.alt { border-color: var(--accent2); color: var(--accent2); }
.btn.danger { border-color: rgba(255,77,106,.5); color: #FF7A90; }
.btn.ghost { background: transparent; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.big { height: 52px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--panel); border: 1px solid rgba(255,255,255,.08); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.icon-btn:hover { border-color: rgba(255,255,255,.25); }
.me-card .icon-btn { width: 36px; height: 36px; border-radius: 10px; }
.pip { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 11px; padding: 6px; }
.av { border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #050507; flex: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.away { background: var(--warn); }
.dot.off { background: var(--dim); }
.tag { display: inline-block; font: 10.5px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line2); color: var(--soft); white-space: nowrap; }
.tag.acc { border-color: var(--accent); color: var(--accent); }
.tag.alt { border-color: var(--accent2); color: var(--accent2); }
.tag.red { border-color: rgba(255,77,106,.6); color: #FF7A90; }
.tag.warn { border-color: rgba(255,178,61,.6); color: var(--warn); }
.tag.ok { border-color: rgba(75,255,138,.5); color: var(--ok); }
.flash { padding: 12px 16px; border-radius: 12px; border: 1px solid var(--accent-line); background: var(--accent-soft); font-size: 14px; }
.flash-err { border-color: rgba(255,77,106,.5); background: rgba(255,77,106,.08); color: #FFC2CC; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.bar { height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }

/* Formulaires */
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); min-width: 0; }
.fld input, .fld select, .fld textarea, .inp { min-height: 44px; border-radius: 10px; background: #07080B; border: 1px solid rgba(255,255,255,.12); color: var(--text); padding: 10px 12px; font-size: 14px; width: 100%; }
.fld textarea { min-height: 110px; resize: vertical; }
.fld input:focus, .fld select:focus, .fld textarea:focus, .inp:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.chk { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--soft); min-height: 36px; cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--accent); }
.client-picker { position: relative; }
.cp-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: #0D0F14; border: 1px solid var(--line2); border-radius: 10px; max-height: 260px; overflow-y: auto; }
.cp-list button { display: block; width: 100%; text-align: left; padding: 10px 12px; background: none; border: 0; color: var(--text); cursor: pointer; font-size: 13.5px; }
.cp-list button:hover, .cp-list button:focus { background: var(--accent-soft); }
.cp-list small { color: var(--muted); font-family: var(--f-mono); font-size: 10.5px; margin-left: 6px; }

/* Tableaux */
.tbl-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); background: #08090C; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font: 10.5px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; font-weight: 500; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: middle; }
.tbl tr:hover td { background: rgba(255,255,255,.02); }
.tbl td a.strong { font-weight: 600; }
.tbl .num { text-align: right; font-family: var(--f-mono); white-space: nowrap; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .inp, .toolbar select { width: auto; min-width: 160px; }
.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--panel); border: 1px solid rgba(255,255,255,.08); flex-wrap: wrap; }
.seg a, .seg button { height: 36px; padding: 0 14px; border-radius: 9px; display: inline-flex; align-items: center; color: var(--soft); font-weight: 600; font-size: 13px; background: none; border: 0; cursor: pointer; }
.seg .on { background: var(--accent); color: #050507; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Liste de tâches */
.task { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; background: rgba(255,255,255,.03); }
.task input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.t-title { font-size: 14px; }
.t-meta { font: 11px var(--f-mono); color: var(--muted); }

/* Pipeline */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.kcol { flex: 0 0 260px; display: flex; flex-direction: column; gap: 10px; min-height: 200px; border-radius: 14px; padding: 4px; }
.kcol.over { background: var(--accent-soft); outline: 1px dashed var(--accent); }
.kcol-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 0; }
.kcol-line { height: 2px; margin: 0 6px; }
.deal { background: #0D0F14; border: 1px solid var(--line); border-radius: 12px; padding: 13px; display: flex; flex-direction: column; gap: 8px; cursor: grab; }
.deal:hover { border-color: rgba(255,255,255,.2); }
.deal.dragging { opacity: .4; }
.deal b { font-size: 14px; }

/* Marques */
.brand-chip { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; border-radius: 14px; border: 1px solid rgba(255,255,255,.08); background: var(--panel); min-height: 60px; }
.brand-chip.on { border-color: var(--b, var(--accent)); background: color-mix(in srgb, var(--b, var(--accent)) 10%, transparent); }
.blogo { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font: 400 18px var(--f-disp); color: #050507; flex: none; overflow: hidden; background: #fff; }
.blogo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.blogo.big { width: 84px; height: 84px; border-radius: 16px; font-size: 32px; }

/* Messagerie */
.chat { display: grid; grid-template-columns: 260px 1fr; height: calc(100vh - 170px); min-height: 520px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #08090C; }
.chat-side { border-right: 1px solid var(--line); padding: 16px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.ch { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: #A3A9B8; font-size: 14px; min-height: 40px; }
.ch:hover { background: rgba(255,255,255,.04); color: #fff; }
.ch.on { background: rgba(255,255,255,.06); color: #fff; }
.ch .ct { margin-left: auto; }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-head { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.chat-log { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 12px; align-items: flex-start; }
.msg .bub { font-size: 14px; line-height: 1.5; color: #D8DCE4; white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.msg .who { font-weight: 700; font-size: 14px; }
.msg time { font: 10.5px var(--f-mono); color: var(--dim); margin-left: 8px; }
.chat-form { padding: 14px 22px 18px; }
.chat-form .box { display: flex; align-items: flex-end; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--accent-line); }
.chat-form textarea { flex: 1; background: transparent; border: 0; outline: 0; resize: none; min-height: 40px; max-height: 160px; padding: 9px 0; color: var(--text); }

/* Agenda */
.cal { display: grid; grid-template-columns: 56px repeat(7, minmax(110px, 1fr)); min-width: 900px; }
.cal-h { padding: 8px 10px; font: 11px var(--f-mono); color: var(--muted); border-bottom: 1px solid var(--line); }
.cal-h.today { color: var(--accent); }
.cal-h b { font-size: 16px; color: var(--text); margin-left: 4px; }
.cal-h.today b { background: var(--accent); color: #050507; padding: 0 6px; border-radius: 6px; }
.cal-hours { display: flex; flex-direction: column; font: 10.5px var(--f-mono); color: var(--dim); }
.cal-hours div { height: 52px; }
.cal-day { position: relative; border-left: 1px solid rgba(255,255,255,.06); background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px); background-size: 100% 52px; }
.ev { position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 6px 8px; font-size: 12px; line-height: 1.3; overflow: hidden; border: 1px solid; }
.ev b { display: block; }
.ev small { font-family: var(--f-mono); font-size: 10px; color: var(--soft); }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); box-shadow: 0 0 12px var(--accent); z-index: 2; }

/* Notifications */
.notif-panel { position: absolute; right: 32px; top: 70px; width: 380px; max-width: calc(100vw - 32px); max-height: 70vh; overflow-y: auto; background: rgba(14,16,21,.98); border: 1px solid var(--line2); border-radius: 14px; padding: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.6); display: flex; flex-direction: column; gap: 10px; z-index: 40; }
.notif { display: block; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.03); font-size: 13px; }
.notif.unread { border-left: 2px solid var(--accent); }
.notif small { display: block; font: 10.5px var(--f-mono); color: var(--muted); margin-top: 2px; }
.toasts { position: fixed; right: 24px; top: 84px; z-index: 60; display: flex; flex-direction: column; gap: 10px; width: 340px; max-width: calc(100vw - 32px); }
.toast { padding: 14px 16px; border-radius: 14px; background: rgba(16,18,24,.96); border: 1px solid var(--accent); box-shadow: 0 20px 60px rgba(0,0,0,.6), var(--glow); font-size: 13.5px; animation: tin .35s ease-out; }
.toast b { display: block; margin-bottom: 2px; }
@keyframes tin { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Timeline / flux */
.feed { display: flex; flex-direction: column; gap: 14px; }
.feed-item { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; }
.feed-item small { display: block; font: 11px var(--f-mono); color: var(--muted); }
.radar { position: relative; padding-left: 22px; display: flex; flex-direction: column; gap: 16px; }
.radar::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: linear-gradient(var(--danger), var(--accent), rgba(255,255,255,.1)); }
.radar .pt { position: relative; }
.radar .pt::before { content: ''; position: absolute; left: -21px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--dim)); box-shadow: 0 0 10px var(--c, transparent); }

/* Droits */
.perm-grid { display: grid; grid-template-columns: minmax(170px, 1fr) repeat(4, 70px); gap: 6px; align-items: center; min-width: 470px; }
.perm-grid .h { font: 10px var(--f-mono); letter-spacing: .1em; color: var(--muted); text-align: center; }
.perm-grid .h:first-child { text-align: left; }
.pcell { display: flex; justify-content: center; }
.pcell input { appearance: none; -webkit-appearance: none; width: 54px; height: 32px; border-radius: 8px; border: 1px solid var(--line2); background: transparent; cursor: pointer; position: relative; margin: 0; }
.pcell input::after { content: '—'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 13px var(--f-mono); color: #4A505C; }
.pcell input:checked { background: var(--accent-soft); border-color: var(--accent-line); }
.pcell input:checked::after { content: '✓'; color: var(--accent); }
.switch { appearance: none; -webkit-appearance: none; width: 44px; height: 24px; border-radius: 24px; background: #2A2E38; position: relative; cursor: pointer; flex: none; margin: 0; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; border-radius: 50%; background: #8A90A0; transition: left .2s, background .2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { left: 24px; background: #050507; }
.switch.red:checked { background: var(--danger); }
.swatch { width: 44px; height: 44px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: #fff; }

/* ---------- Écran d'entrée ---------- */
.login-body { overflow: hidden; height: 100vh; }
#intro3d { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; transition: opacity 1.2s, filter 1.2s; }
.intro-hud { position: fixed; inset: 0; pointer-events: none; font-size: 11px; letter-spacing: .16em; color: var(--muted); transition: opacity .8s; }
.hud-tl { position: absolute; left: 32px; top: 28px; color: var(--accent); }
.hud-tr { position: absolute; right: 32px; top: 28px; color: var(--text); }
.hud-bl { position: absolute; left: 32px; bottom: 28px; line-height: 1.6; }
.hud-bl span { font-size: 32px; color: var(--text); letter-spacing: 0; }
.hud-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.hud-center img { width: min(560px, 70vw); opacity: 0; filter: drop-shadow(0 0 30px rgba(0,0,0,.9)); }
.intro-logo .hud-center img { animation: glitch-in 1.4s steps(1) forwards, logo-glow 1.4s ease-out forwards; }
@keyframes glitch-in {
  0% { opacity: 0; transform: translateX(0); clip-path: inset(0 0 100% 0); }
  10% { opacity: 1; transform: translateX(-6px); clip-path: inset(10% 0 60% 0); }
  20% { transform: translateX(5px); clip-path: inset(40% 0 20% 0); }
  30% { transform: translateX(-2px); clip-path: inset(0 0 0 0); }
  45% { transform: translateX(3px); clip-path: inset(60% 0 5% 0); }
  55%, 100% { opacity: 1; transform: none; clip-path: inset(0 0 0 0); }
}
@keyframes logo-glow { from { filter: drop-shadow(0 0 0 transparent); } to { filter: drop-shadow(0 0 24px rgba(255,255,255,.25)); } }
.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.skip-intro { position: fixed; right: 32px; bottom: 28px; z-index: 5; background: transparent; border: 1px solid var(--line2); color: var(--soft); padding: 10px 14px; border-radius: 10px; cursor: pointer; font-size: 11px; letter-spacing: .14em; }
.skip-intro:hover { border-color: var(--accent); color: var(--accent); }
.login-wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: flex-start; padding: 24px 8vw; opacity: 0; pointer-events: none; transition: opacity 1s .2s, transform 1s .2s; transform: translateY(16px); }
.login-card { width: 420px; max-width: 100%; background: rgba(8,9,12,.82); backdrop-filter: blur(14px); border: 1px solid var(--accent-line); border-radius: 18px; padding: 32px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 30px 100px rgba(0,0,0,.7), var(--glow); }
.login-card h1 { margin: 0; font-size: 72px; }
.login-logo { width: 180px; }
.intro-done .login-wrap { opacity: 1; pointer-events: auto; transform: none; }
.intro-done .intro-hud { opacity: 0; }
.intro-done .skip-intro { display: none; }
.intro-done #intro3d { opacity: .85; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .side { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .25s; box-shadow: 20px 0 60px rgba(0,0,0,.6); }
  .nav-open .side { transform: none; }
  .top .menu-btn { display: inline-flex; }
  .coords { display: none; }
  .top, .page { padding-left: 16px; padding-right: 16px; }
  .chat { grid-template-columns: 1fr; height: auto; }
  .chat-side { border-right: 0; border-bottom: 1px solid var(--line); max-height: 220px; }
  .chat-log { min-height: 50vh; }
  .login-wrap { justify-content: center; padding: 16px; }
  .notif-panel { right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .side, .top, .toasts { display: none !important; }
  body { background: #fff; color: #000; }
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* App mobile & notifications */
.install-step { padding: 14px; border-radius: 12px; background: rgba(255,255,255,.03); border: 1px solid var(--line); font-size: 13px; }
.install-step > b { display: block; font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent2); margin-bottom: 6px; }
.install-step ol { margin: 0; padding-left: 18px; color: var(--soft); line-height: 1.6; }
.push-nudge { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--accent-line); background: linear-gradient(90deg, var(--accent-soft), transparent 70%); }
.push-nudge img { border-radius: 10px; }
@supports (padding: env(safe-area-inset-top)) {
  .top { padding-top: max(16px, env(safe-area-inset-top)); }
  .page { padding-bottom: max(60px, env(safe-area-inset-bottom)); }
}

/* ---------- Agenda « Orbite » (Command Center) ---------- */
.orbit { padding: 22px; overflow: hidden; border-color: var(--accent-line); box-shadow: var(--glow);
  background: radial-gradient(120% 140% at 100% 0%, var(--accent-soft), transparent 55%), linear-gradient(180deg, #0C0E13, #08090C); }
.orbit-scan { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, transparent, var(--accent-soft) 48%, rgba(255,255,255,.05) 50%, transparent 52%); background-size: 220% 100%; animation: orbit-sweep 7s linear infinite; opacity: .55; }
@keyframes orbit-sweep { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.orbit-head { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.orbit-title { font-size: clamp(34px, 3.6vw, 52px); margin-top: 4px; }
.orbit-days { display: flex; gap: 6px; flex-wrap: wrap; }
.orbit-day { width: 58px; height: 70px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(255,255,255,.02); color: var(--soft); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; transition: border-color .2s, background .2s, box-shadow .2s; }
.orbit-day span.mono { font-size: 10px; letter-spacing: .12em; }
.orbit-day b { font: 400 22px var(--f-disp); color: var(--text); }
.orbit-day.today span.mono { color: var(--accent); }
.orbit-day:hover { border-color: rgba(255,255,255,.3); }
.orbit-day.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 22px var(--accent-soft), inset 0 0 12px var(--accent-soft); }
.orbit-dots { display: flex; gap: 3px; height: 5px; }
.orbit-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.orbit-dots i.dl { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.orbit-body { position: relative; display: flex; flex-wrap: wrap; gap: 20px; }
.orbit-scroll { flex: 999 1 600px; min-width: 0; overflow-x: auto; padding-bottom: 6px; }
.orbit-grid { position: relative; min-width: 700px; }
.orbit-lane { display: grid; grid-template-columns: 118px 1fr; min-height: 58px; border-top: 1px solid rgba(255,255,255,.05); }
.orbit-axis { min-height: 26px; border-top: 0; }
.orbit-who { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; padding-right: 8px; min-width: 0; }
.orbit-who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orbit-track { position: relative; background-image: linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px); background-size: calc(100% / 14) 100%; }
.orbit-axis .orbit-track { background: none; }
.orbit-tick { position: absolute; top: 4px; transform: translateX(-50%); font: 10px var(--f-mono); color: var(--dim); letter-spacing: .06em; }
.orbit-tick.minor { width: 1px; height: 6px; top: 16px; background: rgba(255,255,255,.12); }
.orbit-ev { position: absolute; top: 8px; bottom: 8px; border-radius: 10px; padding: 5px 9px; overflow: hidden; display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 26%, transparent), color-mix(in srgb, var(--c) 8%, transparent));
  border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); box-shadow: 0 0 18px color-mix(in srgb, var(--c) 22%, transparent), inset 2px 0 0 var(--c); transition: transform .15s, box-shadow .15s; }
.orbit-ev:hover { transform: translateY(-1px); box-shadow: 0 0 28px color-mix(in srgb, var(--c) 45%, transparent), inset 2px 0 0 var(--c); z-index: 2; }
.orbit-ev b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orbit-ev small { font: 10px var(--f-mono); color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orbit-dl { position: absolute; top: 50%; transform: translate(-6px, -50%); display: flex; align-items: center; gap: 6px; z-index: 1; max-width: 220px; }
.orbit-dl i { width: 12px; height: 12px; background: var(--danger); transform: rotate(45deg); box-shadow: 0 0 12px var(--danger); flex: none; animation: dl-pulse 1.8s ease-in-out infinite; }
.orbit-dl span { font: 11px var(--f-mono); color: #FF8DA0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: rgba(5,5,7,.8); padding: 2px 6px; border-radius: 6px; }
@keyframes dl-pulse { 50% { box-shadow: 0 0 2px var(--danger); } }
.orbit-now { position: absolute; top: 22px; bottom: 0; width: 2px; background: var(--accent); box-shadow: 0 0 14px var(--accent), 0 0 30px var(--accent-soft); z-index: 3; pointer-events: none; }
.orbit-now span { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 700; color: #050507; background: var(--accent); padding: 1px 6px; border-radius: 5px; }
.orbit-empty { padding: 34px 0 26px; text-align: center; color: var(--dim); font-size: 12px; letter-spacing: .14em; }
.orbit-empty a { color: var(--accent); }
.orbit-next { flex: 1 1 260px; min-width: 0; border-left: 1px solid var(--line); padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.orbit-count { font-size: 56px; color: var(--accent); text-shadow: 0 0 24px var(--accent-soft); }
.orbit-first { display: block; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.03); border-left: 2px solid var(--c); }
.orbit-first b { display: block; font-size: 15px; }
.orbit-first small { color: var(--muted); font-size: 10.5px; letter-spacing: .08em; }
.orbit-mini { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 6px 2px; border-bottom: 1px solid rgba(255,255,255,.04); }
@media (max-width: 1000px) {
  .orbit-next { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 14px; }
  .orbit-lane { grid-template-columns: 84px 1fr; }
  .orbit-day { width: 46px; height: 60px; }
}

/* ---------- Vue Mois (Orbite + page Agenda) ---------- */
.mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; min-width: 700px; }
.mhead { font-size: 10px; letter-spacing: .14em; color: var(--muted); text-align: center; padding: 2px 0 4px; }
.mcell { min-height: 108px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: rgba(255,255,255,.015); display: flex; flex-direction: column; gap: 3px; min-width: 0; position: relative; transition: border-color .2s; }
.mcell:hover { border-color: rgba(255,255,255,.2); }
.mcell.blank { background: none; border-style: dashed; border-color: rgba(255,255,255,.04); }
.mcell.we { background: rgba(0,0,0,.25); }
.mcell.past { opacity: .55; }
.mcell.today { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 24px var(--accent-soft), inset 0 0 14px var(--accent-soft); opacity: 1; }
.mcell.has-dl::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px; background: var(--danger); box-shadow: 0 0 10px var(--danger); border-radius: 2px; }
.mnum { display: flex; align-items: center; justify-content: space-between; background: none; border: 0; padding: 0 2px; cursor: pointer; font: 400 20px var(--f-disp); color: var(--text); width: 100%; text-align: left; }
.mcell.today .mnum { color: var(--accent); }
.mcount { font-size: 10px; color: #050507; background: var(--accent2); border-radius: 5px; padding: 0 5px; }
.mchip { display: block; font-size: 11.5px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 2px 6px; border-radius: 6px;
  background: color-mix(in srgb, var(--c) 14%, transparent); border-left: 2px solid var(--c); color: var(--text); }
.mchip:hover { background: color-mix(in srgb, var(--c) 28%, transparent); }
.mchip span { font-size: 9.5px; color: var(--soft); margin-right: 5px; }
.mchip.dl { color: #FF8DA0; }
.mmore { background: none; border: 0; color: var(--accent); font-size: 10.5px; text-align: left; padding: 0 6px; cursor: pointer; }
.orbit .seg button { height: 34px; }
.mgrid.big .mcell { min-height: 132px; }
.orbit.is-month .orbit-next { display: none; }

/* ---------- Agenda : couleurs par collaborateur + ajout rapide ---------- */
.ev { --c: #EDEFF3; background: color-mix(in srgb, var(--c) 15%, #0A0B0F); border-color: color-mix(in srgb, var(--c) 55%, transparent); box-shadow: inset 3px 0 0 var(--c); }
.ev:hover { background: color-mix(in srgb, var(--c) 26%, #0A0B0F); z-index: 3; }
.ev-task { border-style: dashed; display: flex; align-items: center; }
.ev-task small { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-task b { color: var(--c); }
.ev-task.late { box-shadow: inset 3px 0 0 var(--danger), 0 0 12px rgba(255,77,106,.35); }
.ev-task.late b { color: #FF8DA0; }
.mchip.dl { border-left-style: dashed; color: var(--text); }
.mchip.dl span { color: var(--c); font-weight: 700; }
.mchip.late { box-shadow: inset 0 -2px 0 var(--danger); }
.mnum-row { display: flex; align-items: center; gap: 6px; }
.mnum-row .mnum { width: auto; flex: 1; }
.mplus { width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--line2); background: transparent; color: var(--muted); cursor: pointer; font: 700 15px/1 var(--f-mono); opacity: 0; transition: opacity .15s; padding: 0; }
.mcell:hover .mplus, .mplus:focus-visible { opacity: 1; }
.mplus:hover { border-color: var(--accent); color: var(--accent); }
@media (hover: none) { .mplus { opacity: 1; } }
.qc-target { cursor: copy; }
.cal-day.qc-target:hover { background-color: rgba(255,255,255,.015); }
.legend { gap: 8px; }
.legend-chip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 20px; border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); background: color-mix(in srgb, var(--c) 10%, transparent); font-size: 13px; font-weight: 600; cursor: pointer; opacity: .45; transition: opacity .15s; }
.legend-chip.on { opacity: 1; }
.legend-chip input { position: absolute; opacity: 0; pointer-events: none; }
.legend-chip .sw { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.legend-chip:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
dialog.qc { width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px; border-radius: 18px; border: 1px solid var(--accent-line); background: linear-gradient(180deg, #0F1116, #08090C); color: var(--text); box-shadow: 0 40px 120px rgba(0,0,0,.8), var(--glow); }
dialog.qc::backdrop { background: rgba(2,2,4,.72); backdrop-filter: blur(4px); }
dialog.qc[open] { animation: qc-in .2s ease-out; }
@keyframes qc-in { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.qc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.qc-date { font-size: 34px; margin-top: 4px; }
.qc-tabs { margin-bottom: 14px; width: 100%; }
.qc-tabs button { flex: 1; justify-content: center; }
.orbit-track.qc-target { cursor: copy; }
.orbit-dl i { background: var(--c, var(--danger)); box-shadow: 0 0 12px var(--c, var(--danger)); }
.orbit-dl span { color: var(--text); border: 1px dashed var(--c, var(--danger)); }
.orbit-dl.late span { color: #FF8DA0; border-color: var(--danger); }
.orbit-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 12px; }
.ev-task b { display: inline; }

/* ---------- Recherche instantanée ---------- */
.search { position: relative; }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 45; max-height: min(70vh, 560px); overflow-y: auto; padding: 8px;
  background: rgba(12,14,19,.98); border: 1px solid var(--accent-line); border-radius: 14px; box-shadow: 0 30px 90px rgba(0,0,0,.7), var(--glow); backdrop-filter: blur(14px); }
.sr-group + .sr-group { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.sr-head { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 6px 10px 4px; }
.sr-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--text); }
.sr-item:hover, .sr-item.on { background: var(--accent-soft); }
.sr-item.on { box-shadow: inset 2px 0 0 var(--accent); }
.sr-item b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-item small { display: block; font: 11px var(--f-mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-item mark { background: none; color: var(--accent); }
.sr-ico { width: 32px; height: 32px; flex: none; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: var(--c, var(--soft));
  background: color-mix(in srgb, var(--c, #8A90A0) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c, #8A90A0) 35%, transparent); }
.sr-empty { padding: 18px; text-align: center; font-size: 11px; letter-spacing: .14em; color: var(--muted); }
.sr-all { display: block; text-align: center; padding: 10px; margin-top: 6px; font-size: 11px; letter-spacing: .12em; color: var(--accent); border-top: 1px solid var(--line); }

/* ---------- Diffusion à l'équipe ---------- */
dialog.bc .qc-tabs { display: flex; }
.bc-kind { flex: 1; display: flex; align-items: center; justify-content: center; height: 38px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--soft); position: relative; }
.bc-kind input { position: absolute; opacity: 0; pointer-events: none; }
.bc-kind.on { background: var(--accent); color: #050507; }
.bc-kind.urgent.on { background: var(--danger); color: #fff; }
.bc-kind:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
dialog.bc.is-urgent { border-color: rgba(255,77,106,.6); box-shadow: 0 40px 120px rgba(0,0,0,.8), 0 0 50px rgba(255,77,106,.18); }
dialog.bc.is-urgent #bc-send { background: var(--danger); color: #fff; }
.bc-people .legend-chip { opacity: .4; }
.bc-people .legend-chip:has(input:checked) { opacity: 1; box-shadow: 0 0 0 1px var(--c); }
.toast-alert { border-width: 2px; padding: 16px 18px; }
.toast-reunion { border-color: var(--accent2); box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 40px rgba(61,232,255,.2); }
.toast-urgent { border-color: var(--danger); box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 40px rgba(255,77,106,.3); animation: tin .35s ease-out, urgent-pulse 1.6s ease-in-out infinite; }
.toast-urgent b { color: #FF8DA0; }
@keyframes urgent-pulse { 50% { box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 10px rgba(255,77,106,.15); } }
.bc-item.bc-urgent { border-color: rgba(255,77,106,.4); }
.bc-item.bc-reunion { border-color: rgba(61,232,255,.3); }

/* ---------- Messagerie en bulle ---------- */
.bubble-root { position: fixed; right: 22px; bottom: 22px; z-index: 55; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; pointer-events: none; }
.bubble-root > * { pointer-events: auto; }
.bubble-btn { position: relative; width: 62px; height: 62px; border-radius: 50%; border: 1px solid var(--accent-line); background: radial-gradient(circle at 30% 25%, #1A1D24, #07080B 70%); color: var(--accent);
  display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 18px 50px rgba(0,0,0,.6), 0 0 30px var(--accent-soft); transition: transform .2s; }
.bubble-btn:hover { transform: translateY(-2px) scale(1.04); }
.bubble-btn.has-unread { border-color: var(--accent2); color: var(--accent2); box-shadow: 0 18px 50px rgba(0,0,0,.6), 0 0 34px rgba(61,232,255,.3); }
.bubble-btn.ping { animation: bubble-ping .6s ease-out; }
@keyframes bubble-ping { 30% { transform: scale(1.15); } 60% { transform: scale(.95); } }
.bubble-badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent2); color: #050507; font: 700 11px/22px var(--f-mono); text-align: center; box-shadow: 0 0 0 3px var(--bg); }
.bubble-root.open .bubble-btn { color: var(--text); }
.bubble-peek { max-width: 300px; padding: 12px 14px; border-radius: 16px 16px 4px 16px; background: rgba(16,18,24,.97); border: 1px solid var(--accent2); box-shadow: 0 20px 60px rgba(0,0,0,.6); cursor: pointer; font-size: 13px; }
.bubble-peek b { display: block; font-size: 12px; color: var(--accent2); margin-bottom: 2px; }
.bubble-peek span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--text); }
.bubble-peek.pop { animation: tin .3s ease-out; }
.bubble-panel { width: 370px; height: min(560px, calc(100vh - 120px)); display: flex; flex-direction: column; border-radius: 20px; overflow: hidden;
  background: linear-gradient(180deg, #0F1116, #08090C); border: 1px solid var(--accent-line); box-shadow: 0 40px 120px rgba(0,0,0,.75), var(--glow); animation: qc-in .2s ease-out; }
.bp-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.bp-head .icon-btn { width: 36px; height: 36px; border-radius: 10px; }
.bp-head b { font-size: 16px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-list { flex: 1; overflow-y: auto; padding: 6px; }
.bp-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border-radius: 12px; border: 0; background: none; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.bp-item:hover { background: rgba(255,255,255,.04); }
.bp-item .av { position: relative; }
.bp-item .av .st { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #0B0C10; background: var(--dim); }
.bp-item .av .st.on { background: var(--ok); }
.bp-item .av .st.away { background: var(--warn); }
.bp-item b { display: block; font-size: 14px; }
.bp-item small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-item.unread b { color: #fff; }
.bp-item.unread small { color: var(--soft); }
.bp-chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.bp-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bm { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; }
.bm.mine { align-self: flex-end; flex-direction: row-reverse; }
.bm-b { min-width: 0; }
.bm-meta { font-size: 9.5px; color: var(--dim); margin: 0 4px 3px; }
.bm.mine .bm-meta { text-align: right; }
.bm-t { padding: 9px 12px; border-radius: 16px 16px 16px 4px; background: #161920; border: 1px solid var(--line); font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.bm.mine .bm-t { border-radius: 16px 16px 4px 16px; background: var(--accent); color: #050507; border-color: transparent; }
.bp-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.bp-form textarea { flex: 1; resize: none; min-height: 40px; max-height: 110px; padding: 10px 12px; border-radius: 12px; background: #07080B; border: 1px solid var(--line2); color: var(--text); font: 14px var(--f-body); }
.bp-form textarea:focus { outline: none; border-color: var(--accent); }
.bp-form .btn { height: 40px; width: 44px; padding: 0; }
/* bouton : bulle quand fermé, croix quand ouvert */
.bubble-btn .ico-close { display: none; }
.bubble-root.open .bubble-btn .ico-chat { display: none; }
.bubble-root.open .bubble-btn .ico-close { display: block; }
.bubble-root.open .bubble-badge { display: none; }
@media print { .bubble-root { display: none; } }

/* =====================================================================
   MOBILE — tiroir de menu, barre d'onglets, pages compactes (iPhone / Android)
   ===================================================================== */
.side-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.side-close, .nav-scrim, .tabbar { display: none; }
.tab-badge { font-style: normal; }

@media (max-width: 1000px) {
  /* Tiroir : sous l'heure et l'encoche, voile derrière, fermeture au toucher */
  .side { width: min(86vw, 320px); height: 100dvh; padding-top: max(18px, calc(env(safe-area-inset-top) + 8px)); padding-bottom: max(18px, env(safe-area-inset-bottom)); overscroll-behavior: contain; }
  .side-close { display: inline-flex; width: 40px; height: 40px; }
  .brandmark img { width: 132px; }
  .nv { min-height: 44px; font-size: 15px; }
  .nav-scrim { display: block; cursor: pointer; -webkit-tap-highlight-color: transparent; position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .nav-open { overflow: hidden; }
  .nav-open .bubble-root, .nav-open .tabbar { visibility: hidden; }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  /* Barre du haut compacte */
  .top { gap: 8px; padding: 10px 12px; padding-top: max(10px, calc(env(safe-area-inset-top) + 4px)); }
  .top .icon-btn { width: 42px; height: 42px; border-radius: 12px; }
  .search { height: 42px; padding: 0 12px; }
  .search kbd { display: none; }
  .search input::placeholder { color: var(--dim); }
  .notif-panel { left: 10px; right: 10px; top: calc(100% + 6px); width: auto; max-width: none; max-height: 70dvh; }

  /* Pages */
  .page { padding: 18px 14px; padding-bottom: calc(96px + env(safe-area-inset-bottom)); gap: 16px; }
  .ph { align-items: stretch; gap: 12px; }
  .ph > div:first-child { min-width: 0; }
  .ph h1 { font-size: clamp(34px, 11vw, 46px); overflow-wrap: anywhere; }
  .ph .lbl { font-size: 10px; letter-spacing: .1em; }
  .ph-actions { width: 100%; gap: 8px; }
  .ph-actions > .btn, .ph-actions > a.btn, .ph-actions > form { flex: 1 1 auto; }
  .card { padding: 16px; border-radius: 16px; }
  .card .disp { overflow-wrap: break-word; }
  .card .row > div > .disp, .card .row > .disp { font-size: 27px !important; }
  .blogo.big { width: 60px; height: 60px; flex: none; }
  .kpi .disp { font-size: 40px; }
  .cols { gap: 16px; }
  .cols > .main-col, .cols > .side-col { flex-basis: 100%; }

  /* Champs : 16 px évite le zoom automatique de l'iPhone */
  input, select, textarea, .inp, .fld input, .fld select, .fld textarea { font-size: 16px !important; }
  .toolbar { gap: 8px; }
  .toolbar .inp, .toolbar select { flex: 1 1 calc(50% - 8px); min-width: 0; width: auto; }
  .toolbar input[type=search] { flex-basis: 100%; }
  .toolbar .btn { flex: 1 1 auto; }

  /* Tableaux génériques : défilement horizontal propre */
  .tbl-wrap { margin: 0 -14px; border-radius: 0; border-left: 0; border-right: 0; -webkit-overflow-scrolling: touch; }
  .tbl th, .tbl td { padding: 10px 12px; }

  /* Liste clients en cartes */
  .tbl-wrap:has(.m-cards) { margin: 0; border: 0; background: none; overflow: visible; }
  .m-cards thead { display: none; }
  .m-cards, .m-cards tbody { display: block; }
  .m-cards tr { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; padding: 14px; margin-bottom: 10px; border-radius: 14px; border: 1px solid var(--line); background: linear-gradient(180deg, var(--panel2), #0A0B0F); }
  .m-cards td { display: block; padding: 0; border: 0; min-width: 0; }
  .m-cards tr:hover td { background: none; }
  .m-cards td.c-sel { grid-row: 1 / span 3; }
  .m-cards td.c-sel input { width: 20px; height: 20px; }
  .m-cards td.c-name { grid-column: 2; font-size: 16px; }
  .m-cards td.c-status { grid-column: 3; grid-row: 1; }
  .m-cards td.c-brand { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
  .m-cards td.c-line { grid-column: 2 / 4; font-size: 13px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-cards td.c-hide, .m-cards td.c-empty-hide { display: none; }
  .m-cards tr.m-empty { display: block; }

  /* Barre d'onglets en bas */
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding: 6px 6px max(8px, env(safe-area-inset-bottom));
    background: color-mix(in srgb, #07080B 90%, transparent); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-top: 1px solid var(--line2); box-shadow: 0 -20px 40px rgba(0,0,0,.45); }
  .tab { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 54px; border-radius: 14px; color: var(--muted); font: 600 10.5px var(--f-body); letter-spacing: .02em; }
  .tab svg { transition: transform .2s; }
  .tab.on { color: var(--accent); }
  .tab.on::before { content: ''; position: absolute; top: -7px; left: 30%; right: 30%; height: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
  .tab:active svg { transform: scale(.88); }
  .bubble-open .tab.on:not([data-tab-msg]) { color: var(--muted); }
  .bubble-open .tab.on:not([data-tab-msg])::before { display: none; }
  .orbit { padding: 16px; }
  .orbit-head { gap: 12px; }
  .orbit-days { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; padding-bottom: 2px; }
  .orbit-days::-webkit-scrollbar { display: none; }
  .orbit-day { flex: 1 0 44px; width: auto; height: 58px; }
  .tab-badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent2); color: #050507; font: 700 10px/18px var(--f-mono); text-align: center; box-shadow: 0 0 0 2px #07080B; }

  /* Bulle : l'onglet « Messages » la remplace, la fenêtre s'ouvre en plein écran au-dessus des onglets */
  .tabbar ~ .bubble-root .bubble-btn { display: none; }
  .bubble-root { right: 10px; left: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); align-items: stretch; }
  .bubble-peek { max-width: none; }
  .bubble-root.open { top: max(10px, calc(env(safe-area-inset-top) + 6px)); left: 8px; right: 8px; bottom: calc(74px + env(safe-area-inset-bottom)); }
  .bubble-root.open .bubble-panel { width: 100%; height: auto; flex: 1; min-height: 0; border-radius: 18px; }
  .bubble-open { overflow: hidden; }
  .toasts { left: 10px; right: 10px; top: max(10px, env(safe-area-inset-top)); bottom: auto; }

  /* Fenêtres (RDV, tâche, annonce) en feuille plein écran */
  dialog.qc, dialog.bc { width: 100vw; max-width: 100vw; max-height: 100dvh; margin: 0; top: auto; bottom: 0; border-radius: 20px 20px 0 0; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
}
/* Sans la barre d'onglets (bureau / tablette), la bulle garde sa forme ronde */
@media (min-width: 761px) and (max-width: 1000px) {
  .bubble-root.open .bubble-panel { height: min(560px, calc(100dvh - 140px)); }
}

/* ---------- Performance (admin) ---------- */
.lbl.red, .red { color: #FF7A90; }
.card-head.wrap { flex-wrap: wrap; }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 14px; align-items: end; }
.pd { border-radius: 16px; border: 1px solid var(--line2); padding: 18px 12px; text-align: center; background: linear-gradient(180deg, #11131a, #08090c); display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.pd .rk { font: 400 64px/1 var(--f-disp); color: var(--dim); }
.pd.p1 { border-color: var(--accent); box-shadow: 0 0 40px var(--accent-soft); padding-top: 26px; }
.pd.p1 .rk { color: var(--accent); font-size: 84px; text-shadow: 0 0 30px var(--accent-soft); }
.pd b { font-size: 17px; }
.pd .sc { font-size: 12px; font-weight: 700; color: var(--accent2); letter-spacing: .04em; }
.plg { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.plg span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--c); vertical-align: -1px; }
.pchart-wrap, .hm-wrap { overflow-x: auto; }
.pchart { display: flex; align-items: flex-end; gap: 18px; height: 220px; padding: 22px 6px 0; border-bottom: 1px solid var(--line2); min-width: max(100%, calc(var(--n, 6) * 70px)); }
.pcol { flex: 1; min-width: 46px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; position: relative; }
.pcol i { display: block; border-radius: 4px; min-height: 3px; }
.pnum { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--soft); }
.pnames { display: flex; gap: 18px; padding: 8px 6px 0; }
.pnames span { flex: 1; min-width: 46px; text-align: center; font-size: 12px; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm { display: grid; grid-template-columns: 110px repeat(7, minmax(30px, 1fr)) 70px; gap: 5px; align-items: center; font-size: 13px; min-width: 520px; }
.hm .h { font: 10px var(--f-mono); color: var(--muted); text-align: center; letter-spacing: .1em; }
.hm .hm-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm i { height: 30px; border-radius: 7px; display: block; border: 1px solid rgba(255,255,255,.05); background: color-mix(in srgb, var(--accent) var(--a), rgba(255,255,255,.02)); }
.rank td { padding: 10px 8px; }
.rank td small { display: block; font-size: 10.5px; }
.sbar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.07); overflow: hidden; width: 100%; min-width: 60px; }
.sbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); }
.warnrow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.warnrow b { font-size: 14px; }
/* Mode réunion : plein écran, sans menu */
.present .side, .present .top, .present .tabbar, .present .bubble-root, .present .nav-scrim { display: none !important; }
.present .page { padding: 28px 40px; }
.present .ph h1 { font-size: 96px; }
.present .pchart { height: 300px; }
@media (max-width: 760px) {
  .podium { gap: 8px; }
  .pd { padding: 12px 6px; }
  .pd .rk { font-size: 40px; } .pd.p1 .rk { font-size: 54px; }
  .pd .av { width: 44px !important; height: 44px !important; }
  .pd b { font-size: 14px; } .pd .sc { font-size: 10px; }
}
@media print {
  .side, .top, .tabbar, .bubble-root, .ph-actions, .nav-scrim { display: none !important; }
  body { background: #050507 !important; color: var(--text) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .page { padding: 10px; }
  .card { break-inside: avoid; }
}

/* ---------- Assistant IA (dans la bulle) ---------- */
.ai-av { background: linear-gradient(135deg, var(--accent), var(--accent2)) !important; color: #050507; font-weight: 800; }
.bp-ai { background: linear-gradient(90deg, var(--accent-soft), transparent 80%); border: 1px solid var(--accent-line) !important; margin-bottom: 6px; }
.bp-ai .tag { font-size: 9.5px; padding: 2px 6px; }
.bm.bot .bm-t { white-space: pre-wrap; }
.bm.bot { max-width: 94%; }
.ai-card { display: block; margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: #090B0F; border: 1px solid var(--accent-line); white-space: normal; text-decoration: none; }
.ai-card b { display: block; color: var(--accent); font: 700 10.5px var(--f-mono); letter-spacing: .08em; margin-bottom: 3px; }
.ai-card span { display: block; color: var(--text); font-weight: 600; }
.ai-card small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.ai-card:hover { border-color: var(--accent); }
.ai-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; white-space: normal; }
.ai-li { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 10px; background: #090B0F; border: 1px solid var(--line); }
.ai-li b { display: block; font-size: 13px; }
.ai-li small { display: block; font-size: 11.5px; color: var(--muted); }
.ai-li.late small { color: #FF8DA0; }
.ai-ok, .ai-go { flex: none; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--accent-line); background: transparent; color: var(--accent); font-size: 16px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.ai-ok:hover { background: var(--accent); color: #050507; }
.ai-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 11.5px; white-space: normal; }
.ai-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; white-space: normal; }
.ai-acts .btn { height: 30px; font-size: 12px; }
.bp-chips { display: flex; gap: 6px; padding: 8px 10px 0; overflow-x: auto; scrollbar-width: none; }
.bp-chips::-webkit-scrollbar { display: none; }
.bp-chips button { flex: none; font: 500 12.5px var(--f-body); padding: 7px 12px; border-radius: 20px; border: 1px solid var(--line2); background: transparent; color: var(--soft); cursor: pointer; }
.bp-chips button:hover { border-color: var(--accent); color: var(--accent); }
.ai-typing .bm-t { display: flex; gap: 4px; padding: 12px 14px; }
.ai-typing .bm-t i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: ai-dot 1s infinite; }
.ai-typing .bm-t i:nth-child(2) { animation-delay: .15s; } .ai-typing .bm-t i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 30% { transform: translateY(-4px); background: var(--accent); } }
.ai-mode .bp-title::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); margin-right: 8px; vertical-align: 2px; }
/* Grille des droits : défile sur téléphone au lieu de dépasser */
@media (max-width: 760px) {
  .perm-grid { grid-template-columns: minmax(130px, 1fr) repeat(4, 52px); min-width: 0; }
  .perm-grid .h { font-size: 9px; letter-spacing: .04em; }
}
/* Accès à l'assistant IA */
.ai-btn { color: #050507; background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; box-shadow: 0 0 18px var(--accent-soft); }
.ai-btn:hover { filter: brightness(1.08); border-color: transparent; }
.nv-ai { margin: -6px 0 2px; color: #fff; background: linear-gradient(90deg, var(--accent-soft), transparent 85%); border: 1px solid var(--accent-line); }
.nv-ai svg { color: var(--accent); opacity: 1; }
.nv-ai .lk { color: var(--accent); border-color: var(--accent-line); }
.bubble-root.on-chat .bubble-btn { display: none; }
.bubble-root.on-chat:not(.open) .bubble-peek { display: none; }
.ai-card.red { border-color: rgba(255,77,106,.5); }
.ai-card.red b { color: #FF8DA0; }
.ai-ok.del { border-color: rgba(255,77,106,.5); color: #FF8DA0; }
.ai-ok.del:hover { background: var(--danger); color: #fff; }
.ai-eng { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ai-eng label { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 14px 16px 14px 44px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(255,255,255,.02); cursor: pointer; }
.ai-eng label b { font-size: 14px; }
.ai-eng label small { color: var(--muted); font-size: 12px; }
.ai-eng input { position: absolute; left: 16px; top: 17px; width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.ai-eng label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 20px var(--accent-soft); }
@media (max-width: 600px) { .ai-eng { grid-template-columns: 1fr; } }
/* Bandeau « nouvelle version » quand la personne est en train d'écrire */
.upd-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 80; display: flex; flex-direction: column; gap: 2px; text-align: left;
  padding: 12px 16px; border-radius: 14px; border: 1px solid var(--accent); background: rgba(10,12,16,.96); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 30px var(--accent-soft); cursor: pointer; font: inherit; max-width: calc(100vw - 24px); }
.upd-bar b { color: var(--accent); font-size: 13px; }
.upd-bar span { font-size: 12px; color: var(--soft); }
@media (max-width: 760px) { .upd-bar { bottom: calc(84px + env(safe-area-inset-bottom)); } }
/* ---------- Notes de la fiche client ---------- */
.note-new { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; border: 1px dashed var(--accent-line); background: rgba(212,255,58,.03); }
.note-new textarea { min-height: 80px; }
.note { padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.025); display: flex; flex-direction: column; gap: 10px; }
.note header b { font-size: 14px; }
.note-body { white-space: pre-wrap; word-break: break-word; line-height: 1.55; color: var(--text); }
.note-upd { font-size: 10.5px; }
.note-btn { width: 34px; height: 34px; border-radius: 10px; }
.note-btn.del:hover { border-color: rgba(255,77,106,.6); color: #FF8DA0; }
.note form { margin: 0; }
.note-edit { display: flex; flex-direction: column; gap: 8px; }
.note-edit textarea { min-height: 90px; border-radius: 10px; background: #07080B; border: 1px solid var(--accent); color: var(--text); padding: 10px 12px; font: inherit; resize: vertical; }

/* ---------- Fluidité ---------- */
html { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.btn, .icon-btn, .tab, .nv, .bp-item, .ai-ok, .orbit-day { -webkit-user-select: none; user-select: none; }
.btn:active, .icon-btn:active, .bp-item:active, .ai-ok:active, .orbit-day:active { transform: scale(.97); }
.nv:active, .tab:active { opacity: .7; }
/* barre de chargement en haut de l'écran */
.nav-progress { position: fixed; left: 0; top: 0; height: 3px; width: 0; z-index: 200; background: linear-gradient(90deg, var(--accent2), var(--accent)); box-shadow: 0 0 12px var(--accent); opacity: 0; pointer-events: none; }
.nav-loading .nav-progress { opacity: 1; animation: nav-prog 2.5s cubic-bezier(.1,.7,.2,1) forwards; top: env(safe-area-inset-top); }
@keyframes nav-prog { from { width: 0; } to { width: 88%; } }
.nav-loading .page { opacity: .6; transition: opacity .15s .1s; }
@media (max-width: 760px) {
  /* Sur téléphone : effets coûteux allégés (le flou en direct et les balayages animés font ramer l'iPhone au défilement) */
  .top, .tabbar { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .top { background: rgba(5,5,7,.97); }
  .tabbar { background: rgba(7,8,11,.98); }
  .orbit-scan { display: none; }
  .nav-scrim { backdrop-filter: none; }
  .card.glow, .orbit { box-shadow: none; }
  .bp-panel, .bubble-panel { box-shadow: 0 20px 60px rgba(0,0,0,.6); }
  .page { -webkit-overflow-scrolling: touch; }
}
@media (prefers-reduced-motion: reduce) { .nav-loading .nav-progress { animation: none; width: 60%; } }
/* ---------- Fenêtre « Ta journée » ---------- */
dialog.day-sheet { width: min(480px, calc(100vw - 24px)); padding: 18px 18px 22px; }
.day-grab { display: none; width: 42px; height: 5px; border-radius: 3px; background: #333; margin: 0 auto 12px; }
.day-hi { font-size: 40px; margin-top: 4px; }
.day-sec { font: 600 10.5px var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
.day-row { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 8px; border-radius: 14px; background: #0B0D11; border: 1px solid var(--line); border-left: 3px solid var(--c); color: var(--text); text-decoration: none; transition: opacity .2s; }
.day-row b { display: block; font-size: 14.5px; }
.day-row small { display: block; color: var(--muted); font-size: 12.5px; }
.day-row small.late { color: #FF8DA0; }
.day-row.past { opacity: .45; }
.day-row.done { opacity: .45; }
.day-row.done b { text-decoration: line-through; }
.day-tm { font: 700 15px var(--f-mono); color: var(--c); min-width: 50px; }
.day-ck { flex: none; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--accent-line); background: transparent; color: var(--accent); font-weight: 800; font-size: 16px; cursor: pointer; }
.day-ck:hover { background: var(--accent); color: #050507; }
.day-cta { display: flex; gap: 10px; margin-top: 16px; }
.day-cta .btn { flex: 1; }
@media (max-width: 760px) {
  .day-grab { display: block; }
  dialog.day-sheet { width: 100vw; max-width: 100vw; max-height: 88dvh; overflow-y: auto; }
  .day-hi { font-size: 34px; }
}

/* ---------- Fenêtre « Tâches à mettre à jour » ---------- */
dialog.late-sheet { border-color: rgba(255, 77, 109, .55); box-shadow: 0 0 0 1px rgba(255, 77, 109, .15), 0 24px 80px rgba(255, 77, 109, .18); }
.late-sheet .day-hi { font-size: 32px; line-height: 1.05; }
.late-lbl { color: #FF8DA0; }
.late-week { margin: 14px 0 12px; padding: 12px; border-radius: 14px; background: #0B0D11; border: 1px solid var(--line); }
.late-wt { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.late-wt b { color: var(--text); font-weight: 700; }
.late-bar { height: 8px; border-radius: 5px; background: #1A1D24; overflow: hidden; }
.late-bar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent), #7CFFB2); transition: width .5s ease; }
.late-row { align-items: flex-start; }
.late-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.la { flex: none; padding: 7px 11px; border-radius: 9px; border: 1px solid var(--line); background: transparent; color: var(--text); font: 600 12.5px var(--f-body, inherit); cursor: pointer; text-decoration: none; line-height: 1.2; }
.la:hover { border-color: var(--accent-line); }
.la.ok { border-color: var(--accent-line); color: var(--accent); }
.la.ok:hover { background: var(--accent); color: #050507; }
.la:disabled { opacity: .5; cursor: default; }
.pulse-ok { animation: pulseOk 1.2s ease 2; }
@keyframes pulseOk { 50% { box-shadow: 0 0 0 6px rgba(61, 232, 255, .25); } }
@media (max-width: 700px) { .late-sheet .day-hi { font-size: 28px; } .la { padding: 9px 12px; } }

/* Période des tâches (début → fin) */
.t-period { color: var(--accent2, #3DE8FF); font-family: var(--f-mono); font-size: 11px; letter-spacing: .02em; }

/* ---------- Tâches sur plusieurs jours : barres continues (mois + semaine) ---------- */
.mspan { --top: 36px; align-self: start; z-index: 2; margin: calc(var(--top) + var(--lane, 0) * 24px) 4px 0; height: 21px; min-width: 0;
  display: flex; align-items: center; gap: 6px; padding: 0 8px; border-radius: 7px; text-decoration: none; color: var(--text); font-size: 11.5px;
  background: color-mix(in srgb, var(--c) 26%, #0B0D11); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); border-left: 3px solid var(--c);
  box-shadow: 0 2px 10px rgba(0,0,0,.35); transition: background .15s; }
.mspan:hover { background: color-mix(in srgb, var(--c) 40%, #0B0D11); }
.mspan.cut-l { border-left-width: 1px; border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.mspan.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.mspan.late { border-color: var(--danger); box-shadow: 0 0 12px rgba(255,77,106,.25); }
.mspan-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.mspan-end { flex: none; font-size: 9.5px; color: var(--c); font-weight: 700; }
.mspan.late .mspan-end { color: #FF8DA0; }
.mspan-gap { flex: none; height: calc(var(--lanes, 0) * 24px); }
.mgrid .mspan { --top: 34px; }
.mgrid.big .mspan { --top: 37px; }
/* semaine : bande « TÂCHES » au-dessus des heures */
.cal-span-lbl { font-size: 9.5px; color: var(--dim); padding: 8px 4px 0; letter-spacing: .1em; border-bottom: 1px solid var(--line); }
.cal-spans { grid-column: 2 / span 7; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: 24px; gap: 3px 0; padding: 6px 0; border-bottom: 1px solid var(--line); }
.cal-spans .mspan { margin: 0 4px; --top: 0px; }
.cal-spans .mspan.cut-l { margin-left: 0; }
.cal-spans .mspan.cut-r { margin-right: 0; }
/* orbite 7 jours : tâche en cours sur plusieurs jours = bande fine en bas de la ligne */
.orbit-span { position: absolute; bottom: 4px; height: 15px; z-index: 0; border-radius: 4px; text-decoration: none; overflow: hidden;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 30%, transparent) 0 6px, color-mix(in srgb, var(--c) 18%, transparent) 6px 12px); border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); }
.orbit-span span { display: block; font: 9.5px/13px var(--f-mono); color: var(--text); padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.ev-split { padding: 4px 5px; font-size: 11px; }
.ev.ev-split b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* légende de l'orbite = filtre par personne */
.orbit-legend { align-items: center; }
.orbit-legend .legend-chip { color: var(--text); font-family: inherit; }
.orbit-legend .legend-chip:not(.on) .sw { box-shadow: none; background: transparent; border: 2px solid var(--c); }
.orbit-legend .legend-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.legend-all { height: 34px; padding: 0 12px; border-radius: 20px; border: 1px solid var(--accent-line); background: transparent; color: var(--accent); font-size: 11px; letter-spacing: .08em; cursor: pointer; }
.legend-hint { margin-left: 6px; }
@media (max-width: 700px) { .legend-hint { display: none; } }

/* ---------- Tâches en retard / urgentes : animations ---------- */
.ph h1 { padding-top: .12em; } /* les accents (Â, É) ne touchent plus la ligne du dessus */
.task.is-late, .task.is-urgent { position: relative; overflow: hidden; isolation: isolate; }
.task.is-late { background: linear-gradient(90deg, rgba(255,77,106,.13), rgba(255,77,106,.03) 55%, rgba(255,255,255,.02)); box-shadow: inset 0 0 0 1px rgba(255,77,106,.32); }
.task.is-late::before, .task.is-urgent::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 3px; z-index: 1; }
.task.is-late::before { background: var(--danger); animation: fx-breathe 2.2s ease-in-out infinite; }
.task.is-late::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(100deg, transparent 0%, transparent 35%, rgba(255,77,106,.20) 50%, transparent 65%, transparent 100%); background-size: 250% 100%;
  animation: fx-sweep 3.6s cubic-bezier(.4,0,.2,1) infinite; }
.task.is-late input[type=checkbox] { accent-color: var(--danger); }
.task.is-late .t-title { color: #FFD3DA; }
.task.is-urgent { background: linear-gradient(90deg, rgba(255,140,40,.14), rgba(255,77,106,.05) 60%, rgba(255,255,255,.02)); box-shadow: inset 0 0 0 1px rgba(255,150,50,.38), 0 0 18px rgba(255,120,40,.10); animation: fx-ember 2.6s ease-in-out infinite; }
.task.is-urgent::before { width: 4px; background: linear-gradient(0deg, #FF4D6A, #FF8A3D, #FFD23D, #FF8A3D, #FF4D6A); background-size: 100% 300%; animation: fx-flame 1.4s linear infinite; }
.task.is-urgent.is-late { box-shadow: inset 0 0 0 1px rgba(255,77,106,.5), 0 0 22px rgba(255,77,106,.16); }
.tag.fx-late { animation: fx-tag 1.8s ease-in-out infinite; }
.tag.fx-urgent { color: #1A0A00; border: 0; font-weight: 800; background: linear-gradient(90deg, #FFD23D, #FF8A3D, #FF4D6A, #FF8A3D, #FFD23D); background-size: 300% 100%; animation: fx-flame-x 2.4s linear infinite; box-shadow: 0 0 14px rgba(255,138,61,.45); }
.task.done.is-late, .task.done.is-urgent, .task.done.is-late::before, .task.done.is-late::after, .task.done.is-urgent::before { animation: none; background: rgba(255,255,255,.03); box-shadow: none; }
.task.done::after { display: none; }
@keyframes fx-breathe { 0%, 100% { opacity: .55; box-shadow: 0 0 6px var(--danger); } 50% { opacity: 1; box-shadow: 0 0 16px var(--danger), 0 0 30px rgba(255,77,106,.5); } }
@keyframes fx-sweep { 0% { background-position: 120% 0; } 60%, 100% { background-position: -120% 0; } }
@keyframes fx-ember { 0%, 100% { box-shadow: inset 0 0 0 1px rgba(255,150,50,.38), 0 0 14px rgba(255,120,40,.08); } 50% { box-shadow: inset 0 0 0 1px rgba(255,170,60,.7), 0 0 26px rgba(255,120,40,.22); } }
@keyframes fx-flame { 0% { background-position: 0 0; } 100% { background-position: 0 -300%; } }
@keyframes fx-flame-x { 0% { background-position: 0 0; } 100% { background-position: 300% 0; } }
@keyframes fx-tag { 0%, 100% { box-shadow: 0 0 0 rgba(255,77,106,0); } 50% { box-shadow: 0 0 14px rgba(255,77,106,.55); } }
/* arrivée en douceur d'une tâche en retard ou urgente */
.task.is-late, .task.is-urgent { animation-name: fx-in, fx-ember; animation-duration: .6s, 2.6s; animation-timing-function: cubic-bezier(.2,.8,.2,1), ease-in-out; animation-iteration-count: 1, infinite; animation-delay: 0s, .6s; }
.task.is-late:not(.is-urgent) { animation-name: fx-in; animation-duration: .6s; animation-iteration-count: 1; }
@keyframes fx-in { from { transform: translateX(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .task.is-late, .task.is-urgent, .task.is-late::before, .task.is-late::after, .task.is-urgent::before, .tag.fx-late, .tag.fx-urgent { animation: none !important; }
}
/* alertes de tâches dans le CRM ouvert : restent affichées jusqu'à « OK, vu » */
.toast-tache_urgente { border-color: #FF8A3D; box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 40px rgba(255,138,61,.35); animation: tin .35s ease-out, fx-ember 2.2s ease-in-out infinite; }
.toast-tache_urgente b { color: #FFB27A; }
.toast-tache_retard { border-color: var(--danger); box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 40px rgba(255,77,106,.3); animation: tin .35s ease-out, urgent-pulse 1.6s ease-in-out infinite; }
.toast-tache_retard b { color: #FF8DA0; }

/* ---------- Pop-up d'un rendez-vous (3D) ---------- */
dialog.evp { padding: 0; border: 0; background: transparent; max-width: none; max-height: none; width: 100vw; height: 100dvh; overflow: visible; color: var(--text); }
dialog.evp::backdrop { background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c) 14%, rgba(5,5,7,.55)), rgba(5,5,7,.82)); backdrop-filter: blur(6px); animation: evp-bg .3s ease-out; }
dialog.evp.out::backdrop { opacity: 0; transition: opacity .25s; }
.evp-stage { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; perspective: 1300px; }
.evp-card { --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 0%; position: relative; width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow: auto; border-radius: 22px; padding: 20px 20px 18px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 16%, #101219) 0%, #0B0C10 46%, #08090C 100%);
  border: 1px solid color-mix(in srgb, var(--c) 45%, rgba(255,255,255,.08));
  box-shadow: 0 40px 90px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.03) inset, 0 0 60px color-mix(in srgb, var(--c) 22%, transparent);
  transform-style: preserve-3d; transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .18s ease-out;
  animation: evp-in .62s cubic-bezier(.18,1.15,.32,1) backwards; }
.evp-card::before { content: ''; position: absolute; left: 0; top: 18px; bottom: 18px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c); box-shadow: 0 0 18px var(--c); }
.evp.out .evp-card { animation: evp-out .26s cubic-bezier(.5,0,.75,0) both; }
.evp-sheen { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(420px circle at var(--mx) var(--my), rgba(255,255,255,.09), transparent 55%); mix-blend-mode: screen; }
.evp-top { display: flex; align-items: center; gap: 8px; transform: translateZ(30px); }
.evp-kind { font: 600 11px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; padding: 6px 10px; border-radius: 999px; background: color-mix(in srgb, var(--c) 18%, transparent); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); }
.evp-when { font: 700 11px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); display: inline-flex; align-items: center; gap: 6px; }
.evp-when.past { color: var(--muted); }
.evp-when.live { color: #7CFFB2; }
.evp-when.live i { width: 8px; height: 8px; border-radius: 50%; background: #7CFFB2; box-shadow: 0 0 10px #7CFFB2; animation: fx-breathe 1.4s ease-in-out infinite; }
.evp-x { margin-left: auto; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line2); background: rgba(255,255,255,.03); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.evp-x:hover { color: var(--text); border-color: var(--c); }
.evp-head { display: flex; gap: 16px; align-items: center; margin: 18px 0 16px; transform: translateZ(50px); }
.evp-cal { flex: none; width: 74px; border-radius: 16px; overflow: hidden; text-align: center; background: #0E1016; border: 1px solid color-mix(in srgb, var(--c) 50%, transparent);
  box-shadow: 0 14px 30px rgba(0,0,0,.5), 0 0 24px color-mix(in srgb, var(--c) 25%, transparent); transform: translateZ(30px) rotateY(-12deg); animation: evp-cal .9s cubic-bezier(.2,1.3,.3,1) .12s both; }
.evp-cal span { display: block; padding: 4px 0; background: var(--c); color: #050507; font: 800 11px var(--f-mono); text-transform: uppercase; letter-spacing: .12em; }
.evp-cal b { display: block; font: 400 40px/1 var(--f-disp); padding: 6px 0 0; }
.evp-cal small { display: block; font: 10px var(--f-mono); color: var(--muted); text-transform: uppercase; padding: 2px 0 8px; }
.evp-title { font-size: 30px; line-height: 1.02; margin: 0; overflow-wrap: anywhere; }
.evp-day { color: var(--muted); font-size: 13px; margin-top: 6px; }
.evp-rows { display: grid; gap: 8px; transform: translateZ(24px); }
.evp-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 14px; background: rgba(255,255,255,.035); border: 1px solid var(--line); color: var(--text); text-decoration: none;
  animation: evp-row .5s cubic-bezier(.2,.9,.3,1) both; }
.evp-row:nth-child(1) { animation-delay: .16s; } .evp-row:nth-child(2) { animation-delay: .22s; } .evp-row:nth-child(3) { animation-delay: .28s; } .evp-row:nth-child(4) { animation-delay: .34s; } .evp-row:nth-child(5) { animation-delay: .4s; }
.evp-row > svg { flex: none; color: var(--c); }
.evp-row b { display: block; font-size: 14.5px; }
.evp-row small { display: block; color: var(--muted); font-size: 12px; }
.evp-time { font-size: 17px !important; letter-spacing: .02em; }
.evp-link:hover { border-color: color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 10%, transparent); }
.evp-go { margin-left: auto; color: var(--c); font-weight: 700; }
.evp-row > div { min-width: 0; flex: 1; }
.evp-notes { align-items: flex-start; }
.evp-notes p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; max-height: 180px; overflow: auto; }
.evp-av { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 800 11px var(--f-mono); color: #050507; box-shadow: 0 0 12px color-mix(in srgb, var(--c) 40%, transparent); }
.evp-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; transform: translateZ(36px); }
.evp-actions .btn { flex: 1; justify-content: center; display: inline-flex; align-items: center; gap: 6px; }
.evp-actions .btn.primary { flex: 1.2; }
@keyframes evp-in { 0% { opacity: 0; transform: translateY(70px) translateZ(-260px) rotateX(62deg) rotateY(-16deg) scale(.86); } 60% { opacity: 1; } 100% { opacity: 1; transform: rotateX(var(--rx)) rotateY(var(--ry)); } }
@keyframes evp-out { to { opacity: 0; transform: translateY(40px) translateZ(-200px) rotateX(-40deg) scale(.9); } }
@keyframes evp-cal { 0% { opacity: 0; transform: translateZ(120px) rotateY(-80deg); } 100% { opacity: 1; transform: translateZ(30px) rotateY(-12deg); } }
@keyframes evp-row { from { opacity: 0; transform: translateY(10px) translateZ(-30px); } to { opacity: 1; transform: none; } }
@keyframes evp-bg { from { opacity: 0; } }
.ev, .mchip, .orbit-ev { cursor: pointer; }
@media (max-width: 700px) {
  .evp-stage { place-items: end center; padding: 0; perspective: 900px; }
  .evp-card { width: 100%; border-radius: 22px 22px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); max-height: 88dvh; }
  .evp-title { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { .evp-card, .evp-cal, .evp-row { animation: none !important; } .evp-card { transform: none; } }
/* tâche en lecture seule (confiée par quelqu'un d'autre) */
.task-ro .ro-line { display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.03); border: 1px solid var(--line); }
.task-ro .ro-line .lbl { font-size: 10px; }
/* rendez-vous privés */
.ev.ev-private { background: repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 6px, rgba(255,255,255,.015) 6px 12px), #0B0C10; border-style: dashed; color: var(--muted); }
.ev.ev-private b { color: var(--soft); font-weight: 600; }
.ev.ev-mine-private b::after { content: ' 🔒'; font-size: .85em; }
.ev-priv-chk { padding: 10px 12px; border-radius: 12px; border: 1px dashed var(--line2); }
