/* Matoa Prospections : couleurs de la charte (corail Matoa, bleu nuit), mode clair et sombre, pensé d'abord pour le téléphone. */
:root {
  --accent: #f06752; --accent-ink: #c8432f; --accent-soft: #fde8e4;
  --bg: #f5f6fa; --card: #ffffff; --ink: #1b2440; --muted: #5d6680; --line: #e1e4ee; --chip: #eef0f6;
  --ok: #1f8a55; --ok-soft: #e3f4ea; --warn: #a65b00; --warn-soft: #fdf0dc; --danger: #c0392b; --danger-soft: #fbe6e3;
  --band: #1b2440; --shadow: 0 1px 2px rgba(27, 36, 64, .06);
  --s0: #6b7aa6; --s1: #4a77d4; --s2: #2f8fb8; --s3: #2a9d8f; --s4: #3f9d4a; --s5: #c78a12; --s6: #d0682a; --s7: #b34fb0; --s8: #7a59d0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --accent-ink: #ff8e7c; --accent-soft: #3d2420;
  --bg: #0f1424; --card: #182035; --ink: #eef0f7; --muted: #a3abc4; --line: #2a3350; --chip: #222b45;
  --ok: #4cc584; --ok-soft: #173326; --warn: #f2a64a; --warn-soft: #33260f; --danger: #ff7a6b; --danger-soft: #3a1d1a;
  --band: #0a0e1a; --shadow: none; color-scheme: dark;
} }
:root[data-theme="dark"] {
  --accent-ink: #ff8e7c; --accent-soft: #3d2420;
  --bg: #0f1424; --card: #182035; --ink: #eef0f7; --muted: #a3abc4; --line: #2a3350; --chip: #222b45;
  --ok: #4cc584; --ok-soft: #173326; --warn: #f2a64a; --warn-soft: #33260f; --danger: #ff7a6b; --danger-soft: #3a1d1a;
  --band: #0a0e1a; --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box }
html { -webkit-text-size-adjust: 100% }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; font-size: 15px; line-height: 1.5; padding-bottom: env(safe-area-inset-bottom) }
a { color: var(--accent-ink) }
button { font: inherit; color: inherit; cursor: pointer }
button:disabled { opacity: .55; cursor: not-allowed }
img { max-width: 100% }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px }

/* En-tête */
header.top { background: var(--band); isolation: isolate; border-bottom: 3px solid var(--accent); position: sticky; top: 0; z-index: 30; padding-top: env(safe-area-inset-top) }
.bar { display: flex; align-items: center; gap: 16px; min-height: 60px; padding: 6px 16px; max-width: 1180px; margin: 0 auto }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; flex: none }
.brand img { height: 28px; width: auto; display: block }
.brand span { font-weight: 700; font-size: 15px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .35); white-space: nowrap }
nav.tabs { display: flex; gap: 2px; flex: 1; flex-wrap: nowrap; min-width: 0; overflow-x: auto; scrollbar-width: none }
nav.tabs a { color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; padding: 7px 11px; border-radius: 999px; white-space: nowrap }
nav.tabs a:hover { background: rgba(255, 255, 255, .1) }
nav.tabs a.on { background: #fff; color: #1b2440 }
.tools { display: flex; gap: 8px; align-items: center; margin-left: auto }
.who { color: #cfd5e6; font-size: 13px; line-height: 1.2; text-align: right; display: flex; flex-direction: column }
.who small { color: #9aa3bf }
.seg { display: flex; background: #fff; border-radius: 999px; padding: 3px }
.seg button { border: 0; background: none; padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: 12px; color: #555 }
.seg button.on { background: #1b2440; color: #fff }
.round { width: 34px; height: 34px; border-radius: 50%; border: 0; background: #fff; color: #1b2440; display: grid; place-items: center; flex: none }
.round svg { width: 17px; height: 17px }

/* Bandeaux */
.band { display: block; font-size: 13px; font-weight: 600; text-align: center; padding: 7px 12px; text-decoration: none }
.band.off { background: var(--warn-soft); color: var(--warn) }
.band.login { background: var(--danger-soft); color: var(--danger) }
.band.queue { background: var(--accent-soft); color: var(--accent-ink) }

main.wrap { padding-top: 26px; padding-bottom: 40px; min-height: 60vh }
.eyebrow { color: var(--accent-ink); font-weight: 700; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 8px }
h1 { font-size: clamp(24px, 4.5vw, 36px); line-height: 1.12; font-weight: 800; margin: 0 0 12px; letter-spacing: -.01em }
h2 { font-size: 19px; font-weight: 800; margin: 0 0 10px }
h3 { font-size: 15px; font-weight: 700; margin: 16px 0 6px }
.lead { color: var(--muted); font-size: 16px; max-width: 760px; margin: 0 0 22px }
.muted { color: var(--muted) }
.small { font-size: 13px }
.warnt { color: var(--warn); font-weight: 600 }
.empty { color: var(--muted); padding: 14px 0 }
.pre { white-space: pre-wrap }
em { color: var(--accent-ink); font-style: normal }

/* Boutons et puces */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; padding: 9px 15px; font-size: 14px; font-weight: 600; text-decoration: none; min-height: 40px }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff }
.btn.danger { color: var(--danger) }
.btn.big { font-size: 16px; padding: 12px 26px }
.btn svg { width: 16px; height: 16px }
.mini { font-size: 12px; font-weight: 700; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 3px 9px; color: var(--ink) }
.mini.danger { color: var(--danger) }
.link { border: 0; background: none; padding: 0; color: var(--accent-ink); text-decoration: underline; text-align: left }
.pills { display: flex; gap: 6px; flex-wrap: wrap; align-items: center }
.pills.col { flex-direction: column; align-items: stretch }
.pill { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 13px; font-size: 14px; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; color: var(--ink); text-align: left; cursor: pointer }
.pill.on, .pill:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink) }
.pill input[type=radio], .pill input[type=checkbox] { position: absolute; opacity: 0; pointer-events: none }
.chip { display: inline-block; border: 1px solid var(--line); background: var(--chip); border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; text-decoration: none }
.chip.ok { border-color: var(--ok); color: var(--ok); background: var(--ok-soft) }
.chip.wip { border-color: var(--warn); color: var(--warn); background: var(--warn-soft) }
.chip.bad { border-color: var(--danger); color: var(--danger); background: var(--danger-soft) }
.chip[class*="st-n"] { color: #fff; border-color: transparent }
.st-n0 { background: var(--s0) } .st-n1 { background: var(--s1) } .st-n2 { background: var(--s2) } .st-n3 { background: var(--s3) } .st-n4 { background: var(--s4) }
.st-n5 { background: var(--s5) } .st-n6 { background: var(--s6) } .st-n7 { background: var(--s7) } .st-n8 { background: var(--s8) }
.chip.st-signed { background: var(--ok); border-color: var(--ok); color: #fff }
.chip.st-refused { background: var(--danger); border-color: var(--danger); color: #fff }

/* Messages */
.note { background: var(--chip); border-left: 4px solid var(--muted); border-radius: 8px; padding: 10px 14px; margin: 10px 0; font-size: 14px }
.note.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn) }
.note.danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger) }
.note ul { margin: 6px 0 0; padding-left: 20px }
.link-note { display: block; text-decoration: none; color: var(--ink); font-weight: 600 }
.saved { color: var(--ok); font-size: 13px; min-height: 1.2em; margin: -6px 0 10px }

/* Blocs, cartes, grilles */
.block { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow) }
.block h2:first-child { margin-top: 0 }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start }
.cols .block { margin-bottom: 0 }
.cols + .block, .cols + section { margin-top: 14px }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 10px }
.cards { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 8px }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow) }
.card.row, .card .row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap }
.card.click, tr.click { cursor: pointer }
.card.click:hover, tr.click:hover td { background: var(--chip) }
.card.late { border-left: 4px solid var(--warn) }
.card a { text-decoration: none; color: var(--ink) }
.acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0 }
.acts.sticky { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 10px; margin: 0; z-index: 5 }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px }

/* Champs */
.field { display: block; margin: 12px 0 }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px }
input:not([type=radio]):not([type=checkbox]):not([type=file]), textarea, select { font: inherit; font-size: 16px; width: 100%; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 9px; padding: 9px 11px; min-height: 42px }
textarea { resize: vertical }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; align-items: center }
.filters .search { flex: 1 1 220px }
.filters select { flex: 0 1 240px; width: auto }
.filters label { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted) }
.filters label input { width: auto }

/* Tableaux */
.tbl { overflow-x: auto; margin: 6px 0; -webkit-overflow-scrolling: touch }
table { border-collapse: collapse; width: 100%; font-size: 14px }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 8px 10px; vertical-align: top }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; white-space: nowrap }
tr.waiting td { background: var(--warn-soft) }
table.dest { min-width: 720px }
table.dest td { padding: 3px }
table.dest input { padding: 6px 8px; font-size: 15px; min-height: 36px }
dl.kv { display: grid; grid-template-columns: minmax(150px, 34%) 1fr; gap: 6px 14px; margin: 6px 0 }
dl.kv dt { color: var(--muted); font-size: 13px; font-weight: 600 }
dl.kv dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere }

/* Chiffres */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 18px }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px }
.stat span { color: var(--muted); font-size: 13px; font-weight: 600 }
.stat b { font-size: 24px; font-weight: 800; line-height: 1.15 }
.stat small { color: var(--muted); font-size: 12px }
.stat.big b { font-size: 30px; color: var(--accent-ink) }
.stat.warn { border-color: var(--warn) } .stat.warn b { color: var(--warn) }
.stat.bad { border-color: var(--danger) } .stat.bad b { color: var(--danger) }
.stat.okc b { color: var(--ok) }
.stat .chip { align-self: flex-start }

/* Pipeline */
.pipe { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 12px; margin-bottom: 4px }
.pstep { flex: 0 0 auto; min-width: 96px; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 10px; text-align: left; display: flex; flex-direction: column }
.pstep b { font-size: 20px } .pstep span { font-size: 11px; color: var(--muted); line-height: 1.2 }
.pstep.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent) }
.pstep.zero b { color: var(--muted) }
.stepper { list-style: none; display: flex; gap: 4px; padding: 0; margin: 14px 0 }
.stepper li { flex: 1; height: 8px; border-radius: 4px; background: var(--line); position: relative }
.stepper li span { position: absolute; top: 11px; left: 0; font-size: 10px; color: var(--muted) }
.stepper li.done { background: var(--accent) }
.stepper li.now { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft) }
.stepper li.signed { background: var(--ok) } .stepper li.refused { background: var(--danger) }
.timeline { list-style: none; padding: 0; margin: 0 }
.timeline li { border-left: 2px solid var(--line); padding: 0 0 12px 14px; position: relative }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent) }
.timeline p { margin: 4px 0 0; font-size: 14px }
.bars { display: grid; gap: 6px }
.hbar { display: grid; grid-template-columns: minmax(130px, 40%) 1fr 32px; gap: 8px; align-items: center; text-decoration: none; color: var(--ink); font-size: 13px }
.bt { height: 14px; background: var(--chip); border-radius: 4px; overflow: hidden }
.bt i { display: block; height: 100%; background: var(--accent); border-radius: 4px; min-width: 2px }
.bt i.ok { background: var(--ok) } .bt i.no { background: var(--danger) }
.hbar b { text-align: right }
.cbars { display: flex; gap: 6px; height: 170px; align-items: flex-end }
.cb { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; font-size: 11px; color: var(--muted) }
.cb i { width: 100%; max-width: 34px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px }
.cb b { color: var(--ink); font-size: 12px }
.cb span { white-space: nowrap }

/* Fichiers */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 8px 0 }
.thumb { aspect-ratio: 1; border: 1px solid var(--line); background: var(--chip); border-radius: 8px; padding: 0; overflow: hidden; display: grid; place-items: center; font-size: 12px; color: var(--muted) }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block }
.files { list-style: none; padding: 0; margin: 6px 0 }
.files li { margin: 4px 0 }
.atts { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px }
.atts li { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: var(--bg) }
.atts img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; display: block }
.atts audio { width: 64px }
.atts li:has(audio) { grid-template-columns: 1fr auto; } .atts li:has(audio) audio { width: 100%; grid-column: 1 / -1 }
.atts small { display: block }
.ficon { font-size: 30px; text-align: center }
.voice audio { width: 100%; max-width: 480px }

/* Fenêtre */
dialog.modal { border: 0; border-radius: 16px; padding: 0; max-width: min(720px, calc(100vw - 24px)); width: 100%; background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .35) }
dialog.modal::backdrop { background: rgba(10, 14, 26, .55) }
.mbody { padding: 20px; max-height: calc(100vh - 60px); overflow: auto }
.menu { display: grid; gap: 4px; margin-bottom: 14px }
.menu a { display: block; padding: 12px 14px; border-radius: 10px; background: var(--chip); text-decoration: none; color: var(--ink); font-weight: 600 }
.menu-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px }
.menu-tools .seg { border: 1px solid var(--line) }

/* Connexion */
.login { max-width: 460px; margin: 6vh auto; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 30px 24px }
.logo-c { height: 52px; width: auto; margin-bottom: 18px }
body.anon .tabs, body.anon .who, body.anon .desk { display: none }
/* Motif officiel Matoa (le même que sur les offres), en filigrane. Une seule image en masque, teintée selon le thème. */
header.top::before, .hero.motif::before, body::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  -webkit-mask: url(assets/matoa-motif.png) 0 0 / 300px auto repeat; mask: url(assets/matoa-motif.png) 0 0 / 300px auto repeat }
header.top::before { background: #fff; opacity: .07 }
body { position: relative; isolation: isolate; min-height: 100vh }
body::before { position: fixed; background: var(--ink); opacity: .025; -webkit-mask-size: 420px auto; mask-size: 420px auto }
body.anon { background: #1b2440 }
body.anon::before { background: #fff; opacity: .08; -webkit-mask-size: 360px auto; mask-size: 360px auto }
body.anon footer { color: rgba(255, 255, 255, .7); border-color: rgba(255, 255, 255, .15) }
body.anon footer a { color: #ffb3a7 }
body.anon .login { box-shadow: 0 20px 60px rgba(0, 0, 0, .45) }
.hero.motif { position: relative; isolation: isolate; overflow: hidden; border-radius: 18px; padding: 26px 22px 20px; margin: 0 0 22px; color: #fff; background: #1b2440; border-bottom: 4px solid var(--accent) }
.hero.motif::before { background: #fff; opacity: .1; -webkit-mask-size: 260px auto; mask-size: 260px auto }
.hero.motif .eyebrow { color: #ff9b8a }
.hero.motif .lead { color: rgba(255, 255, 255, .82) }
.hero.motif .quick { margin-bottom: 0 }
.hero.motif .btn:not(.accent) { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .3) }

footer { color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); padding: 16px 16px 30px }
.toast { position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 60; max-width: calc(100vw - 32px); text-align: center }
.toast.show { opacity: 1 }

@media (max-width: 1280px) { .who { display: none } }

/* Navigation du bas (téléphone) */
nav.bottom { display: none }
@media (max-width: 860px) {
  nav.tabs, .who, .seg, #theme, .desk { display: none }
  .bar { min-height: 52px }
  .brand img { height: 24px } .brand span { font-size: 14px }
  nav.bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--card); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)) }
  nav.bottom a, nav.bottom button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; border: 0; background: none; border-radius: 10px }
  nav.bottom svg { width: 22px; height: 22px }
  nav.bottom .on { color: var(--accent-ink); background: var(--accent-soft) }
  body:not(.anon) footer { padding-bottom: 90px }
  body:not(.anon) .acts.sticky { bottom: 62px }
  .block { padding: 16px 14px }
  dl.kv { grid-template-columns: 1fr } dl.kv dd { margin-bottom: 8px }
  .grid3 { grid-template-columns: 1fr 1fr }
  .grid3 label:last-child { grid-column: 1 / -1 }
  .bar { gap: 10px }
}
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr } }
@media (min-width: 861px) { body.anon nav.bottom { display: none } }
@media print { header.top, nav.bottom, .toast, #bands, .acts { display: none } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important } }
