/* demo.take-care.africa — espace de démonstration */
:root {
    --navy: #0A1628;
    --navy-2: #12233D;
    --blue: #1EAEE8;
    --blue-dark: #1590C4;
    --teal: #1A9E7A;
    --green: #8DC63F;
    --orange: #E8871E;
    --red: #D64545;
    --text: #1C2B3A;
    --muted: #5A7A8A;
    --line: #E3EEF5;
    --bg: #F3F8FC;
    --card: #FFFFFF;
    --radius: 14px;
    --side: 264px;
    --top: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Inter', system-ui, sans-serif; color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.5; }
h1, h2, h3 { font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; margin: 0; }
a { color: var(--blue-dark); }
button, input, select, textarea { font: inherit; }

/* Boutons */
.dm-btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border: 1px solid transparent; border-radius: 999px; padding: .6rem 1.1rem; font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none; background: #fff; color: var(--text); border-color: var(--line); transition: background .15s, border-color .15s, color .15s; min-height: 40px; }
.dm-btn:hover { border-color: var(--blue); color: var(--blue-dark); }
.dm-btn--primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.dm-btn--primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.dm-btn--danger { background: var(--red); border-color: var(--red); color: #fff; }
.dm-btn--danger:hover { background: #b83636; color: #fff; border-color: #b83636; }
.dm-btn--ok { background: var(--teal); border-color: var(--teal); color: #fff; }
.dm-btn--ok:hover { background: #158566; color: #fff; border-color: #158566; }
.dm-btn--wa { background: #25D366; border-color: #25D366; color: #fff; }
.dm-btn--wa:hover { background: #1DA851; border-color: #1DA851; color: #fff; }
.dm-btn--sm { padding: .35rem .8rem; min-height: 32px; font-size: .82rem; }
.dm-btn:disabled { opacity: .55; cursor: not-allowed; }

/* Page d'entrée (lien absent, invalide, expiré) */
.dm-gate { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(135deg, var(--navy), #0F3B5C); }
.dm-gate__card { background: #fff; border-radius: 20px; padding: 2.2rem 1.6rem; max-width: 520px; width: 100%; text-align: center; box-shadow: 0 30px 60px rgba(0,0,0,.25); }
.dm-gate__logo { height: 46px; margin-bottom: 1.2rem; }
.dm-gate__card h1 { font-size: 1.35rem; margin-bottom: .7rem; }
.dm-gate__card p { color: var(--muted); margin: 0 0 1.4rem; }
.dm-gate__actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }

/* Structure */
.dm-top { position: fixed; inset: 0 0 auto 0; height: var(--top); background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .8rem; padding: 0 .8rem; z-index: 40; }
.dm-burger { width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--navy); cursor: pointer; flex: none; }
.dm-top__brand img { height: 30px; display: block; }
.dm-top__plan { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.dm-top__plan strong { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-top__plan span { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-top__badge { display: none; margin-left: auto; font-size: .75rem; font-weight: 600; color: #8a5a00; background: #FFF4DB; border-radius: 999px; padding: .3rem .7rem; white-space: nowrap; }
.dm-top__cta { margin-left: auto; padding: .5rem .8rem; flex: none; }
.dm-top__cta span { display: none; }
.dm-top__brand { display: none; }

.dm-side { position: fixed; top: var(--top); bottom: 0; left: 0; width: min(86vw, var(--side)); background: var(--navy); color: #C8D6E5; overflow-y: auto; padding: 1rem .7rem 2rem; transform: translateX(-100%); transition: transform .25s ease; z-index: 39; }
.dm-app.is-open .dm-side { transform: none; }
.dm-scrim { position: fixed; inset: var(--top) 0 0 0; background: rgba(10,22,40,.45); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 38; }
.dm-app.is-open .dm-scrim { opacity: 1; pointer-events: auto; }
.dm-main { padding: calc(var(--top) + 1rem) .9rem 3rem; outline: none; min-width: 0; }

.dm-side__title { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: #6F8BA6; margin: 1.1rem .7rem .4rem; }
.dm-side__title:first-child { margin-top: 0; }
.dm-nav { display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left; background: none; border: 0; color: inherit; padding: .55rem .7rem; border-radius: 10px; cursor: pointer; font-size: .88rem; }
.dm-nav i { width: 18px; text-align: center; color: #7FB8DA; }
.dm-nav:hover { background: rgba(255,255,255,.06); color: #fff; }
.dm-nav.is-active { background: var(--blue); color: #fff; }
.dm-nav.is-active i { color: #fff; }
.dm-nav.is-locked { color: #6F8399; }
.dm-nav.is-locked i { color: #51677D; }
.dm-nav__tag { margin-left: auto; font-size: .62rem; font-weight: 700; background: rgba(255,255,255,.08); color: #9DB2C8; padding: .1rem .45rem; border-radius: 999px; white-space: nowrap; }
.dm-nav.is-active .dm-nav__tag { background: rgba(255,255,255,.2); color: #fff; }

/* Contenu */
.dm-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .8rem; margin-bottom: 1rem; }
.dm-head h1 { font-size: 1.35rem; }
.dm-head p { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }
.dm-head__actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.dm-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.dm-card h2 { font-size: 1rem; margin-bottom: .8rem; display: flex; align-items: center; gap: .5rem; }
.dm-card h2 i { color: var(--blue); }
.dm-grid { display: grid; gap: 1rem; }
.dm-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.dm-kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; }
.dm-kpi__lbl { font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.dm-kpi__val { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 1.35rem; margin-top: .2rem; }
.dm-kpi__sub { font-size: .75rem; color: var(--teal); }
.dm-note { font-size: .8rem; color: var(--muted); display: flex; gap: .4rem; align-items: flex-start; }
.dm-note i { color: var(--blue); margin-top: .15rem; }

/* Barre d'outils */
.dm-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .8rem; }
.dm-input, .dm-select, .dm-textarea { border: 1px solid #CFE0EC; border-radius: 10px; padding: .55rem .75rem; background: #fff; color: var(--text); min-height: 40px; width: 100%; }
.dm-input:focus, .dm-select:focus, .dm-textarea:focus { outline: 2px solid rgba(30,174,232,.35); border-color: var(--blue); }
.dm-tools .dm-input { flex: 1 1 200px; width: auto; }
.dm-tools .dm-select { flex: 0 1 200px; width: auto; }

/* Tableaux : cartes sur mobile */
.dm-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.dm-table thead { display: none; }
.dm-table tr { display: block; border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; margin-bottom: .6rem; background: #fff; }
.dm-table td { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; text-align: right; }
.dm-table td::before { content: attr(data-l); color: var(--muted); font-size: .8rem; text-align: left; flex: none; }
.dm-table td.dm-td-act { justify-content: flex-end; gap: .4rem; flex-wrap: wrap; }
.dm-table td.dm-td-act::before { content: none; }
.dm-empty { text-align: center; color: var(--muted); padding: 1.5rem; }

.dm-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; white-space: nowrap; }
.dm-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dm-status-select { border: 1px solid var(--line); border-radius: 999px; padding: .2rem .5rem; font-size: .78rem; font-weight: 600; background: #fff; }

/* Module verrouillé */
.dm-locked { text-align: center; padding: 2.4rem 1.2rem; background: #fff; border: 1px dashed #BFD8EA; border-radius: var(--radius); }
.dm-locked__icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 1rem; background: #EAF6FD; color: var(--blue); font-size: 1.5rem; }
.dm-locked h1 { font-size: 1.25rem; margin-bottom: .5rem; }
.dm-locked p { color: var(--muted); max-width: 520px; margin: 0 auto 1.2rem; }
.dm-locked__preview { filter: grayscale(1) blur(1px); opacity: .45; pointer-events: none; user-select: none; margin-top: 1.6rem; text-align: left; }

/* Graphiques */
.dm-bars { display: flex; align-items: flex-end; gap: .4rem; height: 170px; padding-top: .5rem; }
.dm-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.dm-bar__fill { width: 100%; max-width: 38px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--blue), var(--teal)); transition: height .5s ease; }
.dm-bar__lbl { font-size: .68rem; color: var(--muted); margin-top: .3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dm-bar__val { font-size: .66rem; color: var(--text); margin-bottom: .2rem; white-space: nowrap; }
.dm-hbar { display: grid; grid-template-columns: minmax(90px, 32%) 1fr auto; gap: .6rem; align-items: center; font-size: .84rem; margin-bottom: .5rem; }
.dm-hbar__track { height: 10px; background: #EDF5FA; border-radius: 999px; overflow: hidden; }
.dm-hbar__fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--teal)); border-radius: 999px; }
.dm-list { list-style: none; margin: 0; padding: 0; }
.dm-list li { display: flex; gap: .7rem; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .87rem; align-items: flex-start; }
.dm-list li:last-child { border-bottom: 0; }
.dm-list time { color: var(--muted); font-size: .75rem; margin-left: auto; white-space: nowrap; }

/* Carte */
.dm-map { height: 360px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); z-index: 0; }
.dm-map--tall { height: 440px; }
.dm-fleet { max-height: 440px; overflow-y: auto; }
.dm-fleet__item { display: flex; align-items: center; gap: .6rem; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); padding: .6rem .2rem; cursor: pointer; text-align: left; }
.dm-fleet__item:hover { background: #F5FAFD; }
.dm-fleet__item strong { display: block; font-size: .87rem; }
.dm-fleet__item small { color: var(--muted); font-size: .75rem; display: block; }
.dm-fleet__speed { margin-left: auto; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.dm-veh-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: .75rem; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.leaflet-div-icon.dm-marker { background: none; border: 0; }

/* Calendrier */
.dm-cal { overflow-x: auto; }
.dm-cal table { border-collapse: collapse; min-width: 760px; width: 100%; font-size: .78rem; }
.dm-cal th, .dm-cal td { border: 1px solid var(--line); padding: 0; height: 38px; text-align: center; }
.dm-cal th { background: #F5FAFD; font-weight: 600; padding: .3rem; }
.dm-cal th.dm-cal__veh, .dm-cal td.dm-cal__veh { text-align: left; padding: .3rem .5rem; min-width: 150px; position: sticky; left: 0; background: #fff; z-index: 1; }
.dm-cal td.dm-cal__free { cursor: pointer; }
.dm-cal td.dm-cal__free:hover { background: #EAF6FD; }
.dm-cal td.dm-cal__busy { background: #1EAEE8; color: #fff; font-weight: 600; font-size: .7rem; }
.dm-cal td.dm-cal__maint { background: #F6C343; color: #5a4300; font-weight: 600; font-size: .7rem; }

/* Tableau blanc */
.dm-board { display: grid; gap: .8rem; }
.dm-board__col { background: #EEF5FA; border-radius: 12px; padding: .7rem; }
.dm-board__col h3 { font-size: .9rem; margin-bottom: .6rem; display: flex; justify-content: space-between; }
.dm-sticky { background: #FFF7CC; border-radius: 10px; padding: .6rem .7rem; margin-bottom: .5rem; font-size: .85rem; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.dm-sticky small { display: flex; justify-content: space-between; color: #7a6a20; margin-top: .3rem; font-size: .72rem; gap: .5rem; }
.dm-sticky button { background: none; border: 0; color: #7a6a20; cursor: pointer; padding: 0; }

/* Permissions */
.dm-perm { overflow-x: auto; }
.dm-perm table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: .85rem; }
.dm-perm th, .dm-perm td { padding: .55rem; border-bottom: 1px solid var(--line); text-align: center; }
.dm-perm th:first-child, .dm-perm td:first-child { text-align: left; }
.dm-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.dm-switch input { opacity: 0; width: 0; height: 0; }
.dm-switch span { position: absolute; inset: 0; background: #CBD8E3; border-radius: 999px; transition: background .2s; cursor: pointer; }
.dm-switch span::after { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s; }
.dm-switch input:checked + span { background: var(--teal); }
.dm-switch input:checked + span::after { transform: translateX(18px); }
.dm-switch input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Signature */
.dm-sign { border: 2px dashed #BFD8EA; border-radius: 12px; background: #FBFDFF; width: 100%; height: 180px; touch-action: none; display: block; }

/* Code */
.dm-code { background: var(--navy); color: #CFE8FF; border-radius: 12px; padding: .9rem 1rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; overflow-x: auto; white-space: pre; }

/* Modale */
.dm-modal { position: fixed; inset: 0; background: rgba(10,22,40,.55); display: grid; place-items: center; padding: 1rem; z-index: 100; animation: dmFade .15s ease; }
.dm-modal__box { background: #fff; border-radius: 18px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: 0 30px 60px rgba(0,0,0,.3); }
.dm-modal__head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.dm-modal__head h2 { font-size: 1.05rem; }
.dm-modal__close { background: none; border: 0; font-size: 1.1rem; color: var(--muted); cursor: pointer; width: 36px; height: 36px; border-radius: 8px; }
.dm-modal__close:hover { background: #F0F5F9; }
.dm-modal__body { padding: 1.1rem 1.2rem; }
.dm-modal__body p { margin: 0 0 .8rem; color: #334E68; }
.dm-modal__foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .9rem 1.2rem 1.1rem; flex-wrap: wrap; }
.dm-field { margin-bottom: .8rem; }
.dm-field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .3rem; }
.dm-fields { display: grid; gap: 0 .8rem; }
@keyframes dmFade { from { opacity: 0; } to { opacity: 1; } }

/* Notifications éphémères */
.dm-toasts { position: fixed; right: 1rem; bottom: 1rem; left: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 120; pointer-events: none; align-items: flex-end; }
.dm-toast { background: var(--navy); color: #fff; padding: .75rem 1rem; border-radius: 12px; font-size: .87rem; box-shadow: 0 10px 25px rgba(0,0,0,.25); max-width: 420px; display: flex; gap: .6rem; align-items: flex-start; animation: dmFade .2s ease; pointer-events: auto; }
.dm-toast i { margin-top: .15rem; color: var(--green); }
.dm-toast--warn i { color: #F6C343; }
.dm-toast--err i { color: #FF8A8A; }

@media (min-width: 640px) {
    .dm-main { padding: calc(var(--top) + 1.3rem) 1.4rem 3rem; }
    .dm-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .dm-top__brand { display: block; }
    .dm-top__cta span { display: inline; }
    .dm-fields { grid-template-columns: 1fr 1fr; }
    .dm-fields .dm-field--full { grid-column: 1 / -1; }
    .dm-board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
    .dm-table thead { display: table-header-group; }
    .dm-table tr { display: table-row; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0; margin: 0; }
    .dm-table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .6rem .5rem; border-bottom: 1px solid var(--line); font-weight: 600; white-space: nowrap; }
    .dm-table td { display: table-cell; text-align: left; padding: .6rem .5rem; vertical-align: middle; }
    .dm-table td::before { content: none; }
    .dm-table td.dm-td-act { text-align: right; white-space: nowrap; }
    .dm-table tbody tr:hover { background: #F7FBFE; }
    .dm-grid--2 { grid-template-columns: 2fr 1fr; }
    .dm-grid--half { grid-template-columns: 1fr 1fr; }
    .dm-top__badge { display: inline-flex; gap: .35rem; align-items: center; }
    .dm-top__cta { margin-left: 0; }
}
@media (min-width: 1100px) {
    .dm-burger { display: none; }
    .dm-side { transform: none; width: var(--side); }
    .dm-scrim { display: none; }
    .dm-main { margin-left: var(--side); padding: calc(var(--top) + 1.6rem) 2rem 3rem; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
.dm-nav.is-active.is-locked, .dm-nav.is-active.is-locked i { color: #fff; }

/* Pied de page : droits d'auteur */
.dm-foot { text-align: center; font-size: .78rem; color: var(--muted); padding: 1.5rem 0 .5rem; border-top: 1px solid var(--line); margin-top: 2rem; }
.dm-foot a { color: inherit; font-weight: 600; text-decoration: none; }
.dm-foot a:hover { color: var(--blue-dark); }
.dm-gate { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; }
.dm-gate .dm-foot { color: #9DB2C8; border-top: 0; margin-top: 0; }
.dm-gate .dm-foot a:hover { color: #fff; }
#dmMain { outline: none; }
