/* =====================================================================
   SYNESS 360 — feuille de styles de l'application (app.html, plateforme.html)
   Charte : sarcelle #36998C (primaire), anthracite #464746 (texte, structure),
   gris #A6A6A6 (filets), blanc. Typographie Inter, chiffres à chasse tabulaire.
   ===================================================================== */
:root {
  --brand: #36998C; --brand-strong: #237A6F; --brand-ink: #1E6A60; --brand-tint: #E4F2EF; --brand-soft: #F1F8F6;
  --ink: #2F302F; --ink-2: #464746; --muted: #676867; --line: #DCDDDC; --line-strong: #A6A6A6;
  --bg: #F3F4F3; --surface: #FFFFFF; --surface-2: #F8F9F8;
  --side: #1F2A2E; --side-ink: #E9EAE9; --side-muted: #9FA6A6; --side-active: rgba(255,255,255,.10);
  --ok: #276C45; --ok-bg: #E4F1E8; --warn: #835600; --warn-bg: #FBF0D6; --bad: #A8271F; --bad-bg: #FBE6E3;
  --info: #285C99; --info-bg: #E5EDF7; --neutral: #4E4F4E; --neutral-bg: #ECEDEC; --accent: #E0A43A;
  --wa: #25D366; --wa-bubble: #DCF8C6;
  --radius-sm: 4px; --radius: 6px; --radius-lg: 10px; --radius-xl: 14px;
  --shadow-1: 0 1px 2px rgba(16,24,22,.06), 0 1px 1px rgba(16,24,22,.04);
  --shadow-2: 0 4px 12px rgba(16,24,22,.08), 0 1px 3px rgba(16,24,22,.06);
  --shadow-3: 0 16px 40px rgba(16,24,22,.16), 0 2px 6px rgba(16,24,22,.08);
  --ring: 0 0 0 3px rgba(54,153,140,.28);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --side-w: 248px; --top-h: 60px; --bottom-h: 62px; --ctl-h: 40px;
  --ease: cubic-bezier(.2,.7,.2,1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--ink); }
h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.12rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .6em; }
.num, .tabnum, td.n, .kpi-value { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.xs { font-size: .74rem; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.top { align-items: flex-start; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } .span-2 { grid-column: auto; } }

/* ---------- Mise en page ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side-w); background: var(--side); color: var(--side-ink); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .2s var(--ease); }
.side-brand { height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid rgba(255,255,255,.06); flex: 0 0 auto; }
.side-brand img { width: 30px; height: 30px; border-radius: 7px; }
.side-brand .t { font-weight: 800; letter-spacing: .02em; font-size: 15px; }
.side-brand .t span { color: #7FD3C7; }
.side-tenant { padding: 12px 18px 6px; font-size: .78rem; color: var(--side-muted); }
.side-tenant b { display: block; color: var(--side-ink); font-size: .9rem; font-weight: 600; }
.side-nav { flex: 1 1 auto; overflow-y: auto; padding: 6px 10px 18px; }
.side-nav .grp { font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; color: var(--side-muted); padding: 14px 10px 6px; font-weight: 700; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius); color: var(--side-ink); font-size: .9rem; font-weight: 500; text-decoration: none; }
.side-nav a i { width: 18px; text-align: center; color: var(--side-muted); font-size: .95rem; }
.side-nav a:hover { background: rgba(255,255,255,.05); }
.side-nav a.active { background: var(--side-active); color: #fff; }
.side-nav a.active i { color: #7FD3C7; }
.side-nav a .cnt { margin-left: auto; background: var(--brand); color: #fff; border-radius: 10px; font-size: .7rem; padding: 1px 7px; font-weight: 700; }
.side-foot { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.06); font-size: .75rem; color: var(--side-muted); }
.main { flex: 1 1 auto; margin-left: var(--side-w); min-width: 0; display: flex; flex-direction: column; }
header.top { height: var(--top-h); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 22px; position: sticky; top: 0; z-index: 30; }
header.top .burger { display: none; }
header.top .crumb { font-weight: 700; font-size: 1rem; min-width: 0; }
header.top .search { flex: 0 1 320px; margin-left: auto; position: relative; }
header.top .search input { padding-left: 34px; height: 36px; background: var(--surface-2); }
header.top .search i { position: absolute; left: 12px; top: 11px; color: var(--muted); font-size: .85rem; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1.02rem; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .dot { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--bad); color: #fff; font-size: .66rem; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid var(--surface); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-tint); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex: 0 0 auto; }
.avatar.lg { width: 48px; height: 48px; font-size: 1rem; }
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 6px 4px 4px; border-radius: 24px; border: 0; background: transparent; font: inherit; color: inherit; }
.user-chip:hover { background: var(--surface-2); }
.user-chip .nm { font-size: .85rem; font-weight: 600; max-width: 140px; }
.content { padding: 22px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); font-size: .88rem; margin-top: 3px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bottom-nav { display: none; }
.scrim { display: none; }

@media (max-width: 980px) {
  .side { transform: translateX(-100%); box-shadow: var(--shadow-3); }
  body.nav-open .side { transform: translateX(0); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15,20,18,.45); z-index: 35; }
  .main { margin-left: 0; }
  header.top { padding: 0 12px; }
  header.top .burger { display: inline-flex; }
  header.top .search { display: none; }
  .user-chip .nm { display: none; }
  .content { padding: 14px 12px calc(var(--bottom-h) + 18px); }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: var(--bottom-h); background: var(--surface); border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .68rem; color: var(--muted); text-decoration: none; font-weight: 600; }
  .bottom-nav a i { font-size: 1.1rem; }
  .bottom-nav a.active { color: var(--brand-ink); }
  h1 { font-size: 1.25rem; }
}

/* ---------- Cartes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h2, .card-h h3 { font-size: .98rem; }
.card-h .sub { font-size: .8rem; color: var(--muted); }
.card-b { padding: 16px; }
.card-b.flush { padding: 0; }
.card-f { padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow-1); min-width: 0; }
.kpi .kpi-label { font-size: .78rem; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.kpi .kpi-label i { color: var(--brand); }
.kpi .kpi-value { font-size: 1.55rem; font-weight: 800; margin-top: 4px; letter-spacing: -.01em; }
.kpi .kpi-sub { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.kpi.warn .kpi-value { color: var(--warn); }
.kpi.bad .kpi-value { color: var(--bad); }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 7px 14px; font-size: .9rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; word-break: break-word; }
@media (max-width: 560px) { .dl { grid-template-columns: 1fr; } .dl dt { margin-top: 6px; font-size: .78rem; } }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: var(--ctl-h); padding: 0 15px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--surface-2); border-color: var(--ink-2); }
.btn:focus-visible { outline: 0; box-shadow: var(--ring); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.danger { background: var(--surface); border-color: #E3B2AD; color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #073B1D; }
.btn.sm { height: 32px; padding: 0 11px; font-size: .82rem; }
.btn.xs { height: 26px; padding: 0 8px; font-size: .76rem; border-radius: var(--radius-sm); }
.btn.block { width: 100%; }
.btn.icon { width: var(--ctl-h); padding: 0; }
.btn.sm.icon { width: 32px; }
.btn[disabled], .btn.loading { opacity: .55; pointer-events: none; }
.btn.loading i { animation: spin 1s linear infinite; }
.btn-group { display: inline-flex; flex-wrap: wrap; max-width: 100%; row-gap: 4px; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.btn-group .btn.on { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-ink); z-index: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formulaires (tous stylés) ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .lbl { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.field .req { color: var(--bad); }
.field .hint { font-size: .75rem; color: var(--muted); }
.field .err { font-size: .76rem; color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=search], input[type=url],
input[type=date], input[type=datetime-local], input[type=time], input[type=month], select, textarea {
  width: 100%; height: var(--ctl-h); padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface);
  color: var(--ink); font: inherit; font-size: .9rem; transition: border-color .12s, box-shadow .12s; -webkit-appearance: none; appearance: none;
}
textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
select { padding-right: 36px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23464746' stroke-width='1.6' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
select[multiple] { height: auto; min-height: 110px; padding: 6px; background-image: none; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: #9A9B9A; }
input[disabled], select[disabled], textarea[disabled], input[readonly] { background: var(--surface-2); color: var(--muted); }
.input-sm, select.input-sm { height: 34px; font-size: .84rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }
.check { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: .88rem; line-height: 1.35; user-select: none; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box { flex: 0 0 auto; width: 18px; height: 18px; border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; transition: all .12s; }
.check input[type=radio] + .box { border-radius: 50%; }
.check input:checked + .box { background: var(--brand); border-color: var(--brand); }
.check input:checked + .box::after { content: ''; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.check input[type=radio]:checked + .box::after { width: 8px; height: 8px; border: 0; border-radius: 50%; background: #fff; transform: none; }
.check input:focus-visible + .box { box-shadow: var(--ring); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .88rem; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .tr { width: 38px; height: 22px; border-radius: 11px; background: #C9CAC9; position: relative; transition: background .15s; flex: 0 0 auto; }
.switch .tr::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: left .15s; }
.switch input:checked + .tr { background: var(--brand); }
.switch input:checked + .tr::after { left: 19px; }
.switch input:focus-visible + .tr { box-shadow: var(--ring); }
.file-drop { border: 2px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 26px; text-align: center; color: var(--muted); cursor: pointer; background: var(--surface-2); transition: all .12s; }
.file-drop:hover, .file-drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.file-drop i { font-size: 1.8rem; color: var(--brand); display: block; margin-bottom: 8px; }
.file-drop input { display: none; }
.chips-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--line-strong); border-radius: var(--radius); min-height: var(--ctl-h); background: var(--surface); }
.chips-input input { border: 0 !important; box-shadow: none !important; flex: 1; min-width: 120px; height: 28px; padding: 0 4px; }
.pick-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pick-list label { cursor: pointer; }
.pick-list input { position: absolute; opacity: 0; }
.pick-list span { display: inline-block; padding: 5px 11px; border-radius: 16px; border: 1px solid var(--line-strong); font-size: .82rem; background: var(--surface); }
.pick-list input:checked + span { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.pick-list input:focus-visible + span { box-shadow: var(--ring); }

/* ---------- Pastilles ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 11px; font-size: .74rem; font-weight: 600; background: var(--neutral-bg); color: var(--neutral); white-space: nowrap; line-height: 1.55; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.brand { background: var(--brand-tint); color: var(--brand-ink); }
.badge.dark { background: var(--ink-2); color: #fff; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); font-size: .74rem; color: var(--ink-2); margin: 1px 2px 1px 0; }
.score { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 24px; border-radius: 12px; font-weight: 700; font-size: .78rem; font-variant-numeric: tabular-nums; }
.score.hi { background: var(--ok-bg); color: var(--ok); } .score.mid { background: var(--warn-bg); color: var(--warn); } .score.lo { background: var(--neutral-bg); color: var(--neutral); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover td { background: var(--brand-soft); }
.tbl td.n, .tbl th.n { text-align: right; }
.tbl td .sub { font-size: .76rem; color: var(--muted); }
.tbl td.actions { text-align: right; white-space: nowrap; }
@media (max-width: 720px) {
  table.tbl.responsive thead { display: none; }
  table.tbl.responsive, .tbl.responsive tbody, .tbl.responsive tr, .tbl.responsive td { display: block; width: 100%; }
  .tbl.responsive tr { border-bottom: 1px solid var(--line); padding: 8px 4px; }
  .tbl.responsive td { border: 0; padding: 4px 12px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl.responsive td::before { content: attr(data-label); color: var(--muted); font-size: .76rem; font-weight: 600; text-align: left; flex: 0 0 auto; }
  .tbl.responsive td.main-cell { display: block; text-align: left; font-weight: 600; }
  .tbl.responsive td.main-cell::before { content: none; }
  .tbl.responsive td.actions { justify-content: flex-end; }
  .tbl.responsive td.actions::before { content: none; }
}
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.filters input, .filters select { width: auto; min-width: 140px; height: 36px; font-size: .85rem; }
.filters input[type=search] { min-width: 220px; flex: 1 1 220px; }
@media (max-width: 620px) { .filters input, .filters select { flex: 1 1 100%; min-width: 0; } }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { padding: 10px 14px; font-size: .88rem; font-weight: 600; color: var(--muted); border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; text-decoration: none !important; font-family: inherit; display: inline-flex; gap: 7px; align-items: center; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs a.on, .tabs button.on { color: var(--brand-ink); border-bottom-color: var(--brand); }
.tabs .cnt { background: var(--neutral-bg); border-radius: 9px; padding: 0 7px; font-size: .72rem; }

/* ---------- Fenêtres, menus, toasts ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15,20,18,.5); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 18px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-3); width: 100%; max-width: 560px; max-height: calc(100vh - 36px); display: flex; flex-direction: column; animation: pop .18s var(--ease); }
.modal.wide { max-width: 860px; }
.modal.xl { max-width: 1100px; }
.modal.sm { max-width: 420px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-h h2 { font-size: 1.05rem; }
.modal-b { padding: 18px 20px; overflow-y: auto; }
.modal-f { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
@media (max-width: 620px) {
  .modal-back { align-items: flex-end; padding: 0; }
  .modal, .modal.wide, .modal.xl { max-width: 100%; border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 92vh; animation: up .2s var(--ease); }
  .modal-f { border-radius: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal-f .btn { flex: 1; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
.menu { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); min-width: 220px; padding: 6px; z-index: 90; animation: pop .14s var(--ease); }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 0; background: none; font: inherit; font-size: .88rem; color: var(--ink); border-radius: var(--radius); cursor: pointer; text-align: left; text-decoration: none !important; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu i { width: 18px; color: var(--muted); text-align: center; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.menu .head { padding: 8px 11px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 36px); }
.toast { background: var(--ink); color: #fff; padding: 11px 15px; border-radius: var(--radius-lg); box-shadow: var(--shadow-3); font-size: .88rem; display: flex; gap: 10px; align-items: flex-start; min-width: 240px; max-width: 420px; animation: pop .18s var(--ease); }
.toast i { margin-top: 3px; }
.toast.ok i { color: #7FD3C7; } .toast.bad { background: #7A1D17; } .toast.warn i { color: var(--accent); }
@media (max-width: 980px) { .toasts { bottom: calc(var(--bottom-h) + 12px); left: 12px; right: 12px; } .toast { max-width: none; } }
.notice { padding: 11px 14px; border-radius: var(--radius); font-size: .86rem; display: flex; gap: 10px; align-items: flex-start; border: 1px solid transparent; }
.notice i { margin-top: 3px; }
.notice.info { background: var(--info-bg); color: var(--info); border-color: #C8D7EA; }
.notice.warn { background: var(--warn-bg); color: var(--warn); border-color: #EBD7A6; }
.notice.bad { background: var(--bad-bg); color: var(--bad); border-color: #EEC1BC; }
.notice.ok { background: var(--ok-bg); color: var(--ok); border-color: #BFDCC9; }
.empty { text-align: center; padding: 38px 18px; color: var(--muted); }
.empty i { font-size: 2rem; color: var(--line-strong); display: block; margin-bottom: 10px; }
.empty .t { font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.loader { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--muted); gap: 10px; }
.loader i { animation: spin 1s linear infinite; color: var(--brand); }
.skel { background: linear-gradient(90deg, #ECEDEC 25%, #F5F6F5 50%, #ECEDEC 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Graphiques simples ---------- */
.bars .bar-row { display: grid; grid-template-columns: minmax(0, 130px) minmax(40px, 1fr) auto; gap: 10px; align-items: center; font-size: .84rem; padding: 4px 0; }
.bars .bar-track { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.bars .bar-fill { height: 100%; background: var(--brand); border-radius: 6px; }
.bars .bar-row .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.funnel .step { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.funnel .fb { height: 30px; background: var(--brand); color: #fff; border-radius: var(--radius); display: flex; align-items: center; padding: 0 10px; font-size: .8rem; font-weight: 700; min-width: 34px; transition: width .4s var(--ease); }
.funnel .lbl { width: 110px; font-size: .82rem; color: var(--ink-2); flex: 0 0 auto; }
.funnel .conv { font-size: .74rem; color: var(--muted); }
.progress { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.progress > span { display: block; height: 100%; background: var(--brand); }
.spark-cols { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.spark-cols span { flex: 1; background: var(--brand-tint); border-top: 2px solid var(--brand); min-height: 2px; border-radius: 2px 2px 0 0; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: calc(100vh - 230px); min-height: 120px; }
.kcol-h { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: .84rem; border-bottom: 1px solid var(--line); }
.kcol-h .sum { font-size: .74rem; color: var(--muted); font-weight: 600; }
.kcol-b { padding: 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kcol-b.over { background: var(--brand-soft); }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; font-size: .84rem; cursor: grab; box-shadow: var(--shadow-1); }
.kcard:hover { border-color: var(--brand); }
.kcard .t { font-weight: 700; }
.kcard .m { color: var(--muted); font-size: .76rem; margin-top: 3px; }
.kcard.dragging { opacity: .5; }

/* ---------- Discussion (WhatsApp) ---------- */
.inbox { display: grid; grid-template-columns: 330px 1fr; height: calc(100vh - var(--top-h) - 140px); min-height: 460px; }
.inbox-list { border-right: 1px solid var(--line); overflow-y: auto; }
.conv-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.conv-item:hover { background: var(--surface-2); }
.conv-item.on { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.conv-item .nm { font-weight: 700; font-size: .88rem; }
.conv-item .pv { font-size: .78rem; color: var(--muted); }
.conv-item .tm { font-size: .7rem; color: var(--muted); margin-left: auto; white-space: nowrap; }
.thread { display: flex; flex-direction: column; min-width: 0; }
.thread-h { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.thread-b { flex: 1; overflow-y: auto; padding: 18px; background: #EFEAE2; display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 78%; padding: 8px 11px 6px; border-radius: 9px; font-size: .88rem; line-height: 1.4; box-shadow: 0 1px .5px rgba(0,0,0,.12); white-space: pre-wrap; word-wrap: break-word; }
.bubble.in { background: #fff; align-self: flex-start; border-top-left-radius: 2px; }
.bubble.out { background: var(--wa-bubble); align-self: flex-end; border-top-right-radius: 2px; }
.bubble .meta { font-size: .68rem; color: #667781; text-align: right; margin-top: 3px; }
.bubble .who { font-size: .7rem; font-weight: 700; color: var(--brand-ink); margin-bottom: 2px; }
.thread-f { padding: 10px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-end; background: var(--surface-2); }
.thread-f textarea { min-height: 42px; height: 42px; max-height: 140px; }
@media (max-width: 860px) {
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox.has-sel .inbox-list { display: none; }
  .inbox:not(.has-sel) .thread { display: none; }
  .thread-b { min-height: 55vh; max-height: 62vh; }
}

/* ---------- Écrans d'authentification ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { background: linear-gradient(155deg, #1F2A2E 0%, #23403F 55%, #237A6F 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(127,211,199,.08); }
.auth-art .lg { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.15rem; }
.auth-art .lg img { width: 40px; height: 40px; border-radius: 9px; }
.auth-art h2 { color: #fff; font-size: 1.9rem; font-weight: 800; line-height: 1.2; max-width: 440px; }
.auth-art ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 12px; max-width: 420px; }
.auth-art li { display: flex; gap: 12px; align-items: flex-start; color: #D5E9E5; font-size: .93rem; }
.auth-art li i { color: #7FD3C7; margin-top: 3px; width: 18px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 32px 22px; background: var(--surface); }
.auth-box { width: 100%; max-width: 420px; }
.auth-box h1 { margin-bottom: 6px; }
.auth-box .sub { color: var(--muted); margin-bottom: 22px; }
.auth-box .stack > * + * { margin-top: 14px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 16px; font-size: .86rem; flex-wrap: wrap; gap: 8px; }
.steps-dots { display: flex; gap: 6px; margin-bottom: 16px; }
.steps-dots span { height: 4px; flex: 1; border-radius: 2px; background: var(--line); }
.steps-dots span.on { background: var(--brand); }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 42px; }
.pw-wrap button { position: absolute; right: 4px; top: 4px; width: 32px; height: 32px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: var(--radius); }

/* ---------- Divers ---------- */
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.timeline .it { position: relative; padding: 0 0 14px; }
.timeline .it::before { content: ''; position: absolute; left: -18px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.timeline .it .h { font-size: .84rem; font-weight: 700; }
.timeline .it .d { font-size: .76rem; color: var(--muted); }
.step-card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; background: var(--surface); position: relative; }
.step-card .num { position: absolute; left: -12px; top: 14px; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-size: .75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.perm-grid td { padding: 6px 8px; }
.perm-grid input { width: 96px; height: 30px; font-size: .8rem; font-family: ui-monospace, Menlo, monospace; padding: 0 6px; }
.perm-grid input.changed { border-color: var(--accent); background: #FFF8EA; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; word-break: break-all; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.compare { display: grid; grid-template-columns: 140px 1fr 1fr; font-size: .86rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.compare > div { padding: 7px 10px; border-bottom: 1px solid var(--line); min-width: 0; word-break: break-word; }
.compare .k { background: var(--surface-2); color: var(--muted); font-weight: 600; }
.compare .diff { background: #FFF8EA; }
.sim-phone { max-width: 420px; margin: 0 auto; border: 10px solid #1F2A2E; border-radius: 28px; overflow: hidden; background: #EFEAE2; display: flex; flex-direction: column; height: 600px; }
.sim-phone .sim-h { background: #075E54; color: #fff; padding: 12px 14px; display: flex; gap: 10px; align-items: center; font-weight: 600; }
.sim-phone .sim-b { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.sim-phone .sim-f { display: flex; gap: 6px; padding: 8px; background: #F0F0F0; }
.sim-phone .sim-f input { border-radius: 20px; }
.sim-phone .sim-f button { border-radius: 50%; width: 40px; height: 40px; flex: 0 0 auto; }
@media print { .side, header.top, .bottom-nav, .page-head .actions { display: none !important; } .main { margin: 0; } }

/* ---------- Filtres repliables sur téléphone ---------- */
.mobile-only { display: none; }
@media (max-width: 620px) {
  .mobile-only { display: inline-flex; }
  .filters.collapsible:not(.open) > select, .filters.collapsible:not(.open) > input[type=date], .filters.collapsible:not(.open) > .switch { display: none; }
  .filters.collapsible input[type=search] { flex: 1 1 0; }
  .filters.collapsible .btn.mobile-only { flex: 0 0 auto; }
}

/* ---------- Cartes (Leaflet) ---------- */
.map-box { position: relative; z-index: 0; isolation: isolate; height: 460px; border-radius: var(--radius-lg); border: 1px solid var(--line); overflow: hidden; background: var(--surface-2); }
.map-box.tall { height: calc(100vh - 230px); min-height: 380px; }
@media (max-width: 620px) { .map-box { height: 360px; } .map-box.tall { height: 60vh; } }
.s360-pin span { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50% 50% 50% 2px; transform: rotate(-45deg); color: #fff; font-size: .68rem; font-weight: 700; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.s360-pin span > * { transform: rotate(45deg); }
.leaflet-popup-content { font-family: var(--font); font-size: .84rem; }
.rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.big-btn { min-height: 64px; font-size: 1rem; border-radius: var(--radius-lg); }
@media (max-width: 480px) { .bars .bar-row { grid-template-columns: minmax(0, 96px) minmax(30px, 1fr) auto; gap: 8px; } }
