/* ===================== NOCTA — styles ===================== */
:root {
  --bg: #f4f6fa; --surface: #ffffff; --surface-2: #eef1f6; --border: #dde2ea;
  --text: #0f172a; --muted: #5b6778; --primary: #2f5bea; --primary-ink: #ffffff; --primary-soft: #e3eafd;
  --danger: #dc2626; --danger-soft: #fde2e2; --warn: #d97706; --warn-soft: #fef1d8; --ok: #059669; --ok-soft: #d7f3e8;
  --violet: #7c3aed; --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --radius: 14px; --radius-sm: 9px; --side: 244px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --surface: #131a2e; --surface-2: #1b2340; --border: #273256;
    --text: #e8ecf6; --muted: #93a0bd; --primary: #5b82ff; --primary-soft: #1e2c5c;
    --danger: #f05252; --danger-soft: #3b1720; --warn: #f5a524; --warn-soft: #3a2a10; --ok: #22c38e; --ok-soft: #0f3326;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020; --surface: #131a2e; --surface-2: #1b2340; --border: #273256;
  --text: #e8ecf6; --muted: #93a0bd; --primary: #5b82ff; --primary-soft: #1e2c5c;
  --danger: #f05252; --danger-soft: #3b1720; --warn: #f5a524; --warn-soft: #3a2a10; --ok: #22c38e; --ok-soft: #0f3326;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--primary); }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.08rem; }
small, .muted { color: var(--muted); }
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.ico.big { width: 64px; height: 64px; }
.pulse { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.94); } }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45em; padding: .62em 1.05em; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 42px; }
.btn:hover { border-color: var(--primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: .35em .7em; min-height: 34px; font-size: .88rem; }
.btn-xl { padding: 1em 1.4em; font-size: 1.15rem; min-height: 60px; width: 100%; }
.btn-block { width: 100%; }
.icon-btn { background: none; border: 0; color: inherit; padding: 6px; border-radius: 8px; cursor: pointer; display: inline-flex; }
.icon-btn:hover { background: var(--surface-2); }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: .75rem; }
.grow { flex: 1; }
.right { margin-left: auto; }
.center-pad { padding: 3rem 1rem; display: grid; place-items: center; }

/* Cartes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.card + .card { margin-top: .9rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .7rem; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.grid { display: grid; gap: .9rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; }
.stat b { display: block; font-size: 1.8rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .88rem; }
.stat.red b { color: var(--danger); } .stat.green b { color: var(--ok); } .stat.blue b { color: var(--primary); } .stat.orange b { color: var(--warn); }

/* Badges */
.badge { display: inline-block; align-self: flex-start; line-height: 1.5; padding: .15em .55em; border-radius: 99px; font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.b-a_faire, .b-en_attente, .b-info { background: var(--primary-soft); color: var(--primary); }
.b-en_cours, .b-prise_en_charge, .b-anomalie, .b-sortie, .b-alerte { background: var(--warn-soft); color: var(--warn); }
.b-terminee, .b-cloturee, .b-acceptee, .b-envoye, .b-disponible, .b-ok { background: var(--ok-soft); color: var(--ok); }
.b-annulee, .b-refusee, .b-erreur, .b-urgence, .b-ouverte, .b-perdue, .b-non_configure { background: var(--danger-soft); color: var(--danger); }
.b-ronde { background: var(--primary-soft); color: var(--primary); } .b-intervention { background: var(--danger-soft); color: var(--danger); } .b-gardiennage { background: var(--ok-soft); color: var(--ok); }

/* Tableaux */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th, table.t td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table.t th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); white-space: nowrap; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.clickable { cursor: pointer; } table.t tr.clickable:hover td { background: var(--surface-2); }
table.t td.num, table.t th.num { text-align: right; white-space: nowrap; }

/* Listes */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list-item { display: flex; gap: .75rem; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; background: none; width: 100%; border-left: 0; border-right: 0; border-top: 0; font: inherit; text-align: left; cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 650; }
.list-item .li-sub { color: var(--muted); font-size: .87rem; overflow: hidden; text-overflow: ellipsis; }
.list-group-title { padding: .5rem 1rem; background: var(--surface-2); font-weight: 700; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* Formulaires */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem 1rem; }
.form-grid .full, .form-section { grid-column: 1 / -1; }
.form-section { margin: .6rem 0 0; font-size: .95rem; color: var(--muted); border-bottom: 1px solid var(--border); padding-bottom: .3rem; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
.field small { display: block; margin-top: .25rem; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6em .75em; min-height: 42px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.invalid { border-color: var(--danger) !important; }
.check { display: flex; gap: .6rem; align-items: center; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.check input[type=checkbox], .check input[type=radio] { width: 22px; height: 22px; min-height: 0; flex: none; }
.check input[type=date] { flex: 0 1 auto; width: auto; }
input[type=color] { padding: 2px; height: 42px; }
.search { max-width: 280px; }

/* Modale */
.modal-wrap { position: fixed; inset: 0; background: rgba(5, 10, 25, .55); display: grid; place-items: center; z-index: 1000; padding: 16px; animation: fade .15s; }
.modal-wrap.out { opacity: 0; transition: opacity .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: var(--radius); width: min(560px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal.wide { width: min(900px, 100%); }
.modal.full { width: min(640px, 100%); height: calc(100dvh - 32px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1rem .6rem; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 1rem; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .75rem 1rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
@media (max-width: 620px) { .modal-wrap { padding: 0; align-items: end; } .modal { border-radius: var(--radius) var(--radius) 0 0; max-height: 94dvh; } .modal.full { height: 100dvh; max-height: 100dvh; border-radius: 0; } .modal-foot .btn { flex: 1; } }

/* Toasts */
#toasts { position: fixed; bottom: calc(92px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast { padding: .75rem 1rem; border-radius: 10px; background: #1e293b; color: #fff; box-shadow: var(--shadow); animation: fade .2s; font-weight: 500; }
.toast.out { opacity: 0; transition: opacity .3s; }
.toast-success { background: var(--ok); } .toast-error { background: var(--danger); } .toast-warn { background: var(--warn); }

.spinner { width: 34px; height: 34px; border: 4px solid var(--surface-2); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 2.2rem 1rem; }
.empty .ico { width: 42px; height: 42px; opacity: .5; }

/* ===== Connexion ===== */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 20% 0%, var(--primary-soft), transparent 55%), var(--bg); }
.auth-box { width: min(400px, 100%); }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.5rem; letter-spacing: .02em; }
.brand-logo { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(140deg, #1e3a8a, #2f5bea 60%, #7c3aed); display: grid; place-items: center; color: #fff; }
.brand-logo svg { width: 24px; height: 24px; }
.pin-input { letter-spacing: .5em; font-size: 1.4rem; text-align: center; }

/* ===== Mise en page bureau (superviseur / admin / client) ===== */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100dvh; }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: 1rem .7rem; position: sticky; top: 0; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; gap: .2rem; }
.side .brand { font-size: 1.2rem; padding: .2rem .5rem 1rem; }
.side .brand-logo { width: 34px; height: 34px; }
.nav-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .9rem .6rem .3rem; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: 9px; color: var(--text); text-decoration: none; font-weight: 550; }
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav a .count { margin-left: auto; background: var(--danger); color: #fff; border-radius: 99px; font-size: .72rem; padding: 0 .45em; font-weight: 700; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: .6rem; padding: .7rem 1.3rem; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 50; min-height: 58px; }
.topbar h1 { font-size: 1.15rem; margin: 0; }
.content { padding: 1.3rem; max-width: 1400px; }
.menu-btn { display: none; }
.side-foot { margin-top: auto; padding-top: 1rem; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 200; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .content { padding: 1rem; }
  .topbar { padding: .6rem 1rem; flex-wrap: wrap; }
  .topbar #top-actions { order: 3; width: 100%; margin-left: 0; }
  .topbar #top-actions:empty { display: none; }
}
.side-backdrop { display: none; }
.side.open + .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 150; }

/* ===== Application agent (mobile) ===== */
.agent { max-width: 640px; margin: 0 auto; min-height: 100dvh; padding-bottom: 96px; }
.agent-top { display: flex; align-items: center; gap: .5rem; padding: .8rem 1rem; position: sticky; top: 0; background: var(--bg); z-index: 50; border-bottom: 1px solid var(--border); }
.agent-top .brand { font-size: 1.15rem; } .agent-top .brand-logo { width: 32px; height: 32px; }
.agent-body { padding: 1rem; }
.sync-pill { font-size: .78rem; padding: .2rem .55rem; border-radius: 99px; background: var(--ok-soft); color: var(--ok); font-weight: 700; display: inline-flex; gap: .3rem; align-items: center; }
.sync-pill.off { background: var(--warn-soft); color: var(--warn); }
.status-card { border-radius: var(--radius); padding: 1rem; color: #fff; background: linear-gradient(135deg, #1e3a8a, #2f5bea); box-shadow: var(--shadow); }
.status-card.off { background: linear-gradient(135deg, #334155, #475569); }
.status-card h2 { margin: 0 0 .2rem; font-size: 1.2rem; }
.status-card .btn { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.35); color: #fff; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-top: 1rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: .5rem; min-height: 104px; position: relative; box-shadow: var(--shadow); }
.tile .ico { width: 28px; height: 28px; color: var(--primary); }
.tile b { font-size: 1rem; }
.tile .tile-count { position: absolute; top: .7rem; right: .7rem; background: var(--primary); color: #fff; border-radius: 99px; padding: 0 .5em; font-size: .8rem; font-weight: 700; }
.tile.t-red .ico { color: var(--danger); } .tile.t-green .ico { color: var(--ok); } .tile.t-violet .ico { color: var(--violet); } .tile.t-orange .ico { color: var(--warn); }
.sos-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); display: flex; gap: .6rem; z-index: 60; max-width: 640px; margin: 0 auto; }
.sos-btn { flex: 1; background: var(--danger); color: #fff; border: 0; border-radius: 12px; font-weight: 800; font-size: 1.1rem; letter-spacing: .08em; min-height: 56px; cursor: pointer; box-shadow: 0 4px 14px rgba(220,38,38,.35); }
.pti-btn { flex: 0 0 auto; min-height: 56px; border-radius: 12px; padding: 0 1rem; }
.pti-btn.on { background: var(--ok); color: #fff; border-color: var(--ok); }
.call-mini { flex: 0 0 auto; min-height: 56px; border-radius: 12px; padding: 0 .9rem; }
.call-mini .ico { width: 22px; height: 22px; }
/* SOS : SMS d'alerte et appels */
.sos-panel h4 { margin: 1rem 0 .4rem; font-size: .95rem; }
.sos-panel .sos-sms { display: flex; align-items: center; justify-content: center; gap: .5rem; margin-top: .8rem; text-decoration: none; box-shadow: 0 4px 14px rgba(220,38,38,.35); }
.sos-panel .sos-sms .ico { width: 24px; height: 24px; }
.sos-to { margin: .4rem 0 0; font-size: .88rem; }
.call-list { display: flex; flex-direction: column; gap: .5rem; }
.call-row { display: flex; gap: .5rem; align-items: stretch; }
.call-btn { flex: 1; justify-content: flex-start; text-align: left; min-height: 52px; gap: .7rem; text-decoration: none; }
.call-btn .ico { color: var(--ok); width: 22px; height: 22px; flex: none; }
.call-btn span { display: flex; flex-direction: column; line-height: 1.25; }
.call-row > .btn-sm { min-width: 52px; justify-content: center; text-decoration: none; }
.sos-site { font-size: .9rem; margin-bottom: .5rem; }
.sos-112 .btn { text-decoration: none; }
.sos-112 small { color: var(--muted); font-weight: 500; }
body:has(.sos-panel) #toasts { display: none !important; }
.prealarm-box .btn + .btn { margin-top: .8rem; }
.back-link { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); text-decoration: none; font-weight: 600; margin-bottom: .6rem; }
.cp-item { display: flex; gap: .7rem; align-items: center; padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
.cp-item:last-child { border-bottom: 0; }
.cp-dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; flex: none; color: #fff; }
.cp-item.done .cp-dot { background: var(--ok); border-color: var(--ok); }
.cp-item.anomaly .cp-dot { background: var(--danger); border-color: var(--danger); }
.scan-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.scan-actions .btn { flex-direction: column; min-height: 76px; font-size: .88rem; }
.scan-actions .btn .ico { width: 26px; height: 26px; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ok); transition: width .3s; }
.info-box { background: var(--primary-soft); color: var(--text); border-radius: var(--radius-sm); padding: .7rem .9rem; font-size: .92rem; }
.warn-box { background: var(--warn-soft); border-radius: var(--radius-sm); padding: .7rem .9rem; font-size: .92rem; }
.danger-box { background: var(--danger-soft); border-radius: var(--radius-sm); padding: .7rem .9rem; font-size: .92rem; }
.pre { white-space: pre-wrap; }

/* Scanner / NFC */
.scanner { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 3/4; max-height: 70dvh; margin: 0 auto; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 20%; border: 3px solid #fff; border-radius: 16px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.scan-hint { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; color: #fff; font-weight: 600; padding: 0 1rem; }
.nfc-wait { text-align: center; padding: 1.5rem 0; color: var(--primary); }
.nfc-wait p { color: var(--text); }

/* Signature / médias */
.sig { border: 1px dashed var(--border); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.sig canvas { width: 100%; height: 170px; display: block; touch-action: none; }
.sig-foot { display: flex; justify-content: space-between; align-items: center; padding: .3rem .5rem; background: var(--surface-2); color: var(--muted); font-size: .85rem; }
.media-picker { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.media-list { display: flex; flex-wrap: wrap; gap: .5rem; width: 100%; }
.media-list:empty { display: none; }
.thumb { position: relative; width: 82px; height: 82px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; line-height: 1; }
.gallery { display: flex; flex-wrap: wrap; gap: .5rem; }
.gallery img, .gallery video { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); cursor: zoom-in; }

/* Pré-alarme PTI et alerte superviseur */
.prealarm { position: fixed; inset: 0; z-index: 3000; background: #b91c1c; color: #fff; display: grid; place-items: center; padding: 20px; animation: flash 1s infinite; }
@keyframes flash { 50% { background: #7f1d1d; } }
.prealarm-box { text-align: center; width: min(420px, 100%); }
.prealarm-count { font-size: 6rem; font-weight: 900; line-height: 1; margin: 1rem 0 1.5rem; }
#alert-stack { position: fixed; top: 16px; right: 16px; z-index: 2500; width: min(380px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.alert-pop { background: var(--surface); border: 3px solid var(--danger); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(220,38,38,.4); padding: 1rem; animation: shake .5s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.alert-pop h3 { color: var(--danger); }

/* Carte */
.map { height: 420px; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; z-index: 1; }
.map.small { height: 260px; }
.agent-marker { background: var(--primary); color: #fff; border-radius: 50%; width: 34px; height: 34px; display: grid !important; place-items: center; font-weight: 800; font-size: .8rem; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.agent-marker.sos { background: var(--danger); animation: pulse 1s infinite; }

/* Planning */
.planning-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); max-height: calc(100dvh - 230px); }
table.planning { border-collapse: separate; border-spacing: 0; font-size: .82rem; min-width: 100%; }
table.planning th, table.planning td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; vertical-align: top; }
table.planning th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; font-weight: 700; white-space: nowrap; text-align: center; }
table.planning th.we, table.planning td.we { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
table.planning th.hol { color: var(--danger); }
table.planning td.agent-col, table.planning th.agent-col { position: sticky; left: 0; background: var(--surface); z-index: 3; min-width: 150px; font-weight: 650; }
table.planning th.agent-col { z-index: 4; background: var(--surface-2); }
table.planning td.cell { min-width: 96px; max-width: 150px; height: 52px; cursor: pointer; }
table.planning.month td.cell { min-width: 64px; }
table.planning td.cell:hover { background: var(--primary-soft); }
table.planning td.cell.drop { outline: 2px dashed var(--primary); outline-offset: -3px; }
.vac { display: block; border-radius: 6px; padding: 2px 5px; color: #fff; font-weight: 650; margin-bottom: 3px; cursor: grab; font-size: .76rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vac.warn { box-shadow: inset 0 0 0 2px #fde047; }
.vac small { color: rgba(255,255,255,.85); display: block; }
.legend { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .85rem; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.warn-list li { margin-bottom: .3rem; }
.lvl-erreur { color: var(--danger); font-weight: 650; } .lvl-alerte { color: var(--warn); font-weight: 650; } .lvl-info { color: var(--muted); }

.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: .6rem .9rem; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.qr-label { display: inline-block; text-align: center; border: 1px dashed var(--border); padding: 10px; margin: 6px; border-radius: 10px; width: 200px; background: #fff; color: #000; }
.qr-label img { width: 170px; height: 170px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 550; }
.feed-item { display: flex; align-items: flex-start; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.feed-item:last-child { border-bottom: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); margin-top: .4em; flex: none; }
.dot.red { background: var(--danger); } .dot.green { background: var(--ok); } .dot.orange { background: var(--warn); }
.setup { max-width: 680px; margin: 2rem auto; padding: 16px; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 5px; font-size: .9em; }

@media print {
  .side, .topbar, .no-print, .sos-bar, #toasts, #alert-stack, .modal-wrap { display: none !important; }
  .shell { display: block; } .content { padding: 0; }
  body { background: #fff; }
}

table.t td.name-col { min-width: 170px; }

/* Photos */
.btn-photo { background: var(--primary); border-color: var(--primary); color: #fff; width: 100%; min-height: 54px; font-size: 1.05rem; }
.media-more { display: flex; gap: .5rem; flex-wrap: wrap; width: 100%; }
.media-picker { flex-direction: column; align-items: stretch; }
/* Logos */
.brand-logo { background: none !important; width: 38px; height: 38px; }
.brand-logo img, img.brand-img { width: 100%; height: 100%; display: block; }
.co-logo { height: 38px; max-width: 120px; object-fit: contain; border-radius: 8px; background: #fff; padding: 2px; }
.co-brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.co-brand b { font-size: 1rem; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; }
.co-brand small { display: block; font-size: .72rem; color: var(--muted); font-weight: 600; letter-spacing: .06em; }
.auth-logo { height: 64px; max-width: 220px; object-fit: contain; }
/* v6.4 : nouveau logo Nocta (logo complet sur l'écran de connexion, pastille ronde ailleurs) */
.brand-full { display: block; width: min(230px, 64%); height: auto; margin: 0 auto .2rem; border-radius: 22px; box-shadow: 0 12px 32px rgba(10, 22, 40, .32); }
img.nocta-mark { background: none; padding: 0; border-radius: 50%; }
.planning-head { display: none; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.planning-head img { height: 54px; max-width: 180px; object-fit: contain; }
@media print {
  .planning-head { display: flex !important; }
  @page { size: landscape; margin: 10mm; }
  .planning-wrap { max-height: none !important; overflow: visible !important; }
  .legend .muted, .warn-list { display: none; }
}
/* Lecteur PDF */
.pdf-view { background: #525659; border-radius: 10px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 200px; }
.pdf-view canvas { max-width: 100%; height: auto !important; box-shadow: 0 2px 8px rgba(0,0,0,.4); background: #fff; }
.doc-btn { display: inline-flex; align-items: center; gap: .4rem; margin-top: .5rem; }
.review-box { border: 2px solid var(--border); border-radius: var(--radius-sm); padding: .8rem; }
.review-box.valide { border-color: var(--ok); } .review-box.a_corriger { border-color: var(--danger); }
.b-a_controler { background: var(--warn-soft); color: var(--warn); } .b-valide { background: var(--ok-soft); color: var(--ok); } .b-a_corriger { background: var(--danger-soft); color: var(--danger); }
.alert-pop.late { border-color: var(--warn); box-shadow: 0 12px 40px rgba(217,119,6,.35); animation: none; }
.alert-pop.late h3 { color: var(--warn); }

/* v5 : envoi du planning, espace éditeur */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .3rem .8rem; max-height: 260px; overflow: auto; padding: .4rem; border: 1px solid var(--border); border-radius: 10px; }
.b-sans_email { background: var(--warn-soft); color: var(--warn); }
.b-non_demande { background: var(--primary-soft); color: var(--primary); }
.notice-card { display: flex; gap: .8rem; align-items: center; background: var(--primary-soft); border: 1px solid var(--primary); border-radius: 14px; padding: .8rem 1rem; margin-bottom: 1rem; }
.notice-card b { display: block; }
.notice-card .grow { min-width: 0; }
.plan-chip { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--primary-soft); color: var(--primary); }
.plan-chip.off { background: var(--danger-soft); color: var(--danger); }

/* liste d'adresses e-mail */
.email-list .chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .45rem; }
.email-list .chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: .2rem .35rem .2rem .7rem; font-size: .88rem; font-weight: 600; max-width: 100%; overflow-wrap: anywhere; }
.chip-x { border: 0; background: transparent; color: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0 .3rem; border-radius: 999px; }
.chip-x:hover { background: rgba(0,0,0,.08); }
.email-add { flex-wrap: nowrap; }
.email-add input { flex: 1; min-width: 0; }

/* v6 : planning — cases sans rien de prévu grisées, congés payés (CP) et indisponibilités */
:root { --cp-bg: #e0f2fe; --cp-ink: #075985; --cp-line: #38bdf8; --ind-bg: #eef2f6; --ind-ink: #334155; --ind-line: #94a3b8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --cp-bg: #0c2a3f; --cp-ink: #7dd3fc; --cp-line: #0369a1; --ind-bg: #1e263d; --ind-ink: #cbd5e1; --ind-line: #475569; } }
:root[data-theme="dark"] { --cp-bg: #0c2a3f; --cp-ink: #7dd3fc; --cp-line: #0369a1; --ind-bg: #1e263d; --ind-ink: #cbd5e1; --ind-line: #475569; }
.abs { display: block; border-radius: 6px; padding: 3px 4px; font-weight: 800; font-size: .78rem; line-height: 1.2; text-align: center; letter-spacing: .03em; margin-bottom: 3px; cursor: pointer; border: 1.5px solid; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.abs.cp { background: var(--cp-bg); color: var(--cp-ink); border-color: var(--cp-line); }
.abs.indispo { background: var(--ind-bg); color: var(--ind-ink); border-color: var(--ind-line); }
.abs.pending { border-style: dashed; opacity: .8; }
.legend-abs { display: inline-block; font-size: .7rem; padding: 0 5px; margin-right: 3px; cursor: default; }
.btn-abs { font-weight: 800; }
@media print { table.planning, table.planning td, .abs, .vac { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
/* v6 : aperçu des mails */
.mail-frame { width: 100%; height: min(70vh, 760px); border: 1px solid var(--border); border-radius: 12px; background: #eef1f5; display: block; }
/* v6.1 : fiches clients / sites, télésurveillances, rapport d'intervention */
[hidden] { display: none !important; }
.ok-box { background: var(--ok-soft); border-radius: var(--radius-sm); padding: .7rem .9rem; font-size: .95rem; display: flex; gap: .5rem; align-items: center; }
.ok-box .ico { color: var(--ok); flex: none; }
.danger-zone { border: 1px solid var(--danger); }
.danger-zone h3 { color: var(--danger); }
/* Questions Oui / Non */
.yn { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; border-radius: var(--radius-sm); }
.yn-opt { position: relative; display: block; cursor: pointer; }
.yn-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.yn-opt span { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 2px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-weight: 700; font-size: 1.02rem; user-select: none; }
.yn-opt input:focus-visible + span { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
.yn-opt input:checked + span { border-color: var(--primary); background: var(--primary); color: var(--primary-ink); }
.yn-non input:checked + span { border-color: var(--text); background: var(--text); color: var(--surface); }
.yn.invalid .yn-opt span { border-color: var(--danger); }
/* Liste déroulante avec recherche */
.ss { position: relative; }
.ss-box { display: flex; align-items: center; gap: .4rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: 0 .5rem 0 .7rem; }
.ss-box > .ico { color: var(--muted); flex: none; }
.ss-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ss .ss-input { border: 0; background: transparent; box-shadow: none; padding-left: 0; padding-right: 0; flex: 1; min-width: 0; outline: none; }
.ss.has-value .ss-box { border-color: var(--primary); background: var(--primary-soft); }
.ss.has-value .ss-input { font-weight: 700; }
.ss.invalid .ss-box { border-color: var(--danger); }
.ss-clear { border: 0; background: var(--surface-2); color: var(--muted); width: 30px; height: 30px; border-radius: 99px; font-size: 1.2rem; line-height: 1; cursor: pointer; flex: none; }
.ss-list { margin-top: .3rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); max-height: 280px; overflow: auto; box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
.ss-item { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); padding: .65rem .8rem; cursor: pointer; font: inherit; }
.ss-item:last-child { border-bottom: 0; }
.ss-item small { display: block; color: var(--muted); font-size: .82rem; margin-top: .1rem; }
.ss-item:hover, .ss-item.act { background: var(--surface-2); }
.ss-item.sel { background: var(--primary-soft); }
.ss-empty { padding: .7rem .8rem; color: var(--muted); font-size: .9rem; }
.form-grid + .form-grid { margin-top: .8rem; }

/* ===================== v6.2 : secteurs, fiche de tournée, tracé GPS ===================== */
.tabs a { padding: .6rem .9rem; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.b-non_faite { background: var(--danger-soft); color: var(--danger); }
/* Types de ronde */
.rt { display: inline-block; padding: .08em .55em; border-radius: 99px; font-size: .74rem; font-weight: 800; letter-spacing: .02em; background: var(--surface-2); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.rt-ouverture { background: #dcfce7; color: #166534; }
.rt-fermeture { background: #dbeafe; color: #1e40af; }
.rt-aleatoire { background: #ede9fe; color: #5b21b6; }
.rt-complementaire { background: #ffedd5; color: #9a3412; }
:root[data-theme="dark"] .rt-ouverture { background: #0f3326; color: #86efac; }
:root[data-theme="dark"] .rt-fermeture { background: #1e2c5c; color: #93c5fd; }
:root[data-theme="dark"] .rt-aleatoire { background: #2e1f5c; color: #c4b5fd; }
:root[data-theme="dark"] .rt-complementaire { background: #3a2a10; color: #fdba74; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rt-ouverture { background: #0f3326; color: #86efac; }
  :root:not([data-theme="light"]) .rt-fermeture { background: #1e2c5c; color: #93c5fd; }
  :root:not([data-theme="light"]) .rt-aleatoire { background: #2e1f5c; color: #c4b5fd; }
  :root:not([data-theme="light"]) .rt-complementaire { background: #3a2a10; color: #fdba74; }
}
.pass-info { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin: .2rem 0 .7rem; font-size: .92rem; }
/* Fiche de tournée (agent) */
.tour-block { margin-bottom: 1.4rem; }
.tour-head { display: flex; align-items: center; gap: .8rem; border-left: 6px solid var(--primary); padding: .2rem 0 .2rem .8rem; margin-bottom: .6rem; }
.tour-head b { display: block; font-size: 1.05rem; }
.tour-count { text-align: center; line-height: 1.1; }
.tour-count b { font-size: 1.6rem; color: var(--primary); }
.tour-count small { display: block; font-size: .72rem; }
.pass-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem .95rem; box-shadow: var(--shadow); }
.pass-card.next { border: 2px solid var(--primary); }
.pass-card.late { border-color: var(--danger); }
.pass-top { display: flex; gap: .75rem; align-items: flex-start; }
.pass-no { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 800; font-size: .92rem; }
.pass-when { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .15rem; }
.pass-when b { font-size: 1.02rem; }
.pass-site { font-weight: 650; }
.pass-more { margin-top: .55rem; }
.pass-more summary, .tour-done summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: .9rem; }
.pass-more .pre { margin-top: .35rem; }
.tour-done { margin-top: .8rem; }
.tour-done-item { padding: .3rem 0; font-size: .9rem; border-bottom: 1px dashed var(--border); }
.tour-done-item .ok { color: var(--ok); font-weight: 800; } .tour-done-item .ko { color: var(--danger); font-weight: 800; }
/* Secteur (encadrement) */
.pass-mini { margin: .4rem 0 .6rem 1.2rem; padding: 0; }
.pass-mini li { margin: .22rem 0; }
.pm-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.pass-list { display: flex; flex-direction: column; gap: .5rem; }
.pass-row { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem .6rem; background: var(--surface-2); }
.pass-row-head { display: flex; align-items: center; gap: .4rem; }
.pass-row-head .btn { min-height: 32px; padding: .2em .55em; }
.pass-fields { display: flex; flex-wrap: wrap; gap: .45rem .6rem; align-items: center; margin-top: .45rem; }
.pass-fields select, .pass-fields input { width: auto; min-height: 38px; }
.pass-fields .pf-time, .pass-fields .pf-dur { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; color: var(--muted); }
.pass-fields .pf-dur input { width: 5.2em; }
.pass-fields .pf-notes { flex: 1 1 260px; }
.pass-fields .need { border-color: var(--danger); background: var(--danger-soft); }
.pf-days { display: inline-flex; gap: 3px; }
.pf-days .day { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 700; font-size: .78rem; cursor: pointer; padding: 0; }
.pf-days .day.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pass-warn { display: block; color: var(--warn); margin-top: .3rem; }
.site-picker { display: flex; flex-wrap: wrap; gap: .4rem; max-height: 240px; overflow: auto; padding: .5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.site-pick { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .7rem; border-radius: 99px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: .88rem; cursor: pointer; text-align: left; }
.site-pick small { font-size: .78rem; }
.site-pick:hover { border-color: var(--primary); }
.site-pick.added { background: var(--ok-soft); border-color: var(--ok); }
.site-pick[hidden] { display: none; }
/* Tracé GPS d'une ronde */
.trace-map { height: 340px; border-radius: var(--radius-sm); margin: .3rem 0 .4rem; }
.trace-dot { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #fff; color: #fff; font: 800 12px/20px Helvetica, Arial, sans-serif; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
@media (max-width: 600px) { .pass-fields .pf-notes { flex-basis: 100%; } .trace-map { height: 260px; } }
.grid > .card + .card { margin-top: 0; } /* cartes côte à côte : alignées en haut */

/* v6.3 — RGPD & sécurité */
.linkish { background: none; border: 0; color: var(--primary); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .3rem 0; }
.linkish:hover { text-decoration: underline; }
.linkish .ico { width: 16px; height: 16px; }
.todo-list { margin: 0; padding-left: 1.3rem; display: grid; gap: .45rem; }
.todo-list a { color: var(--primary); font-weight: 600; }
.stack-sm { display: grid; gap: .35rem; }
.rgpd-text h4 { color: var(--text); }
.rgpd-text .pre { line-height: 1.5; }
/* v6.5 : planning par prestations (secteurs, postes fixes) — vue du mois comme les plannings papier */
.presta-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .65rem .75rem; margin-bottom: .8rem; }
.presta-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.presta-head small { font-size: .8rem; }
.presta-list { display: flex; gap: .45rem; flex-wrap: wrap; }
.presta { --pc: #2f5bea; display: inline-flex; align-items: center; gap: .5rem; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: .3rem .6rem .3rem .3rem; cursor: grab; font: inherit; text-align: left; max-width: 260px; }
.presta b { background: var(--pc); color: #fff; border-radius: 7px; padding: .3rem .45rem; font-size: .82rem; letter-spacing: .02em; min-width: 2.6rem; text-align: center; }
.presta span { display: flex; flex-direction: column; font-weight: 650; font-size: .84rem; line-height: 1.2; min-width: 0; overflow: hidden; }
.presta span, .presta small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.presta small { color: var(--muted); font-weight: 600; font-size: .74rem; }
.presta:hover { border-color: var(--pc); }
.presta.on { border-color: var(--pc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc) 30%, transparent); background: color-mix(in srgb, var(--pc) 9%, var(--surface)); }
.presta { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.presta-abs.cp { --pc: var(--cp-line); }
.presta-abs.indispo { --pc: var(--ind-line); }
.presta-abs b { border: 1.5px solid var(--pc); }
.presta-abs.cp b { background: var(--cp-bg); color: var(--cp-ink); }
.presta-abs.indispo b { background: var(--ind-bg); color: var(--ind-ink); }
.presta-ghost { position: fixed; left: 0; top: 0; z-index: 9999; pointer-events: none; opacity: .92; box-shadow: 0 10px 28px rgba(0, 0, 0, .35); border-color: var(--pc); }
@media (max-width: 600px) {
  .presta-list { gap: .35rem; }
  .presta { max-width: calc(50% - .2rem); gap: .35rem; padding: .2rem .4rem .2rem .2rem; border-radius: 9px; }
  .presta b { font-size: .74rem; padding: .25rem .3rem; min-width: 2.2rem; }
  .presta span { font-size: .76rem; }
  .presta small { font-size: .66rem; }
  .presta-abs small { display: none; }
  .presta-head small { font-size: .74rem; }
}
.paint-bar { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; padding: .5rem .7rem; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-size: .88rem; }
.paint-bar span { flex: 1; min-width: 0; }
table.planning.painting td.cell { cursor: copy; }
table.planning.painting td.cell:hover { outline: 2px dashed var(--primary); outline-offset: -3px; }
table.planning th.today { color: var(--primary); box-shadow: inset 0 -3px 0 var(--primary); }
table.planning.month th { font-size: .72rem; padding: 3px 1px; min-width: 32px; }
table.planning.month td.agent-col, table.planning.month th.agent-col { min-width: 128px; max-width: 150px; font-size: .78rem; }
table.planning.month th small { font-weight: 700; color: var(--muted); }
table.planning.month td.cell { min-width: 32px; max-width: 44px; padding: 1px; height: 46px; }
.vac.vm { display: flex; flex-direction: column; align-items: center; padding: 2px 0; font-size: .7rem; line-height: 1.1; text-overflow: clip; border-radius: 5px; margin-bottom: 2px; }
.vac.vm b { font-size: .7rem; letter-spacing: 0; }
.vac.vm small { display: block; font-size: .58rem; font-weight: 600; color: rgba(255, 255, 255, .92); }
table.planning.month .abs { font-size: .7rem; padding: 3px 1px; }
table.planning tfoot td { position: sticky; bottom: 0; background: var(--surface-2); font-size: .72rem; font-weight: 700; color: var(--muted); border-top: 2px solid var(--border); padding: 4px 2px; text-align: center; }
table.planning tfoot td.agent-col { text-align: left; color: var(--text); z-index: 3; }
.legend span { max-width: 100%; }
/* Bandeau du mois (Mon planning, application de l'agent) */
.mstrip-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); -webkit-overflow-scrolling: touch; }
table.mstrip { border-collapse: separate; border-spacing: 0; font-size: .72rem; }
table.mstrip th, table.mstrip td { border-right: 1px solid var(--border); text-align: center; min-width: 40px; padding: 3px 2px; }
table.mstrip th { background: var(--surface-2); font-weight: 800; line-height: 1.1; border-bottom: 1px solid var(--border); }
table.mstrip th small { display: block; color: var(--muted); font-weight: 700; }
table.mstrip th.we, table.mstrip td.we { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
table.mstrip th.hol { color: var(--danger); }
table.mstrip th.today { color: var(--primary); box-shadow: inset 0 -3px 0 var(--primary); }
table.mstrip td { height: 50px; vertical-align: middle; }
.mcode { display: flex; flex-direction: column; align-items: center; border-radius: 6px; color: #fff; padding: 2px 1px; line-height: 1.1; }
.mcode b { font-size: .74rem; }
.mcode small { font-size: .62rem; font-weight: 600; color: rgba(255, 255, 255, .92); }
table.mstrip .abs { margin: 0; font-size: .68rem; padding: 3px 1px; }
.sector-code { display: inline-block; background: var(--sc, var(--primary)); color: #fff; border-radius: 6px; padding: .05rem .4rem; font-size: .78rem; font-weight: 800; letter-spacing: .02em; vertical-align: 1px; }
