/* Système « Confiance de proximité » : tokens de 03-DESIGN-SYSTEM.md (proposition, à valider D01). */
:root {
  --canvas: #F6F4EE;
  --surface: #FFFFFF;
  --ink: #142C2B;
  --ink-2: #1D3A38;
  --muted: #53645F;
  --primary: #B94720;
  --primary-press: #9C3A18;
  --primary-tint: #F8E7DF;
  --positive: #24766A;
  --positive-tint: #E2F0EC;
  --danger: #B4232C;
  --danger-tint: #FBE6E6;
  --warning: #805900;
  --warning-tint: #FBF0D6;
  --info-tint: #E6ECEB;
  --border: #D9DFD9;
  --border-strong: #B9C4BE;
  --focus-halo: #F2C9B8;
  --r-ctl: 10px;
  --r-surf: 14px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --font: "Noto Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --shadow-overlay: 0 12px 32px rgba(20, 44, 43, .18);
  --sidebar: 232px;
  --t: 180ms;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--font); line-height: 1.47; -webkit-font-smoothing: antialiased; }
@media (prefers-reduced-motion: reduce) { :root { --t: 0ms; } * { animation: none !important; transition: none !important; } }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.9rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--ink); }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.xs { font-size: .8rem; }
.b { font-weight: 700; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[tabindex="-1"]:focus { outline: none; box-shadow: none; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 6px var(--focus-halo); border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; }
.skip:focus { left: 8px; }

/* ---------- Coque ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #E8EEEC; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: 22px 20px 18px; }
.brand .l1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; color: #fff; }
.brand .l1 span, .brand .l0 span { color: #E77A4F; }
.brand .l0 { display: none; font-size: 1.3rem; font-weight: 800; color: #fff; }
.brand .l2 { font-size: .95rem; font-weight: 800; letter-spacing: .06em; color: #fff; }
.brand .l3 { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: #A9BDB8; margin-top: 4px; }
.nav { padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 10px; color: #E8EEEC; text-decoration: none; font-weight: 600; }
.nav a:hover { background: var(--ink-2); }
.nav a[aria-current="page"] { background: var(--primary); color: #fff; }
.nav a .cnt { margin-left: auto; background: var(--danger); color: #fff; font-size: .75rem; border-radius: 99px; padding: 1px 8px; font-weight: 700; }
.nav .sub { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 34px; }
.nav .sub a { min-height: 36px; font-weight: 500; font-size: .92rem; color: #C9D6D2; padding: 0 10px; }
.nav .sub a[aria-current="page"] { background: #2E5450; color: #fff; box-shadow: inset 0 0 0 1px #E77A4F; }
.nav .lot2 { font-size: .68rem; border: 1px solid #6F8A84; border-radius: 6px; padding: 0 5px; margin-left: 6px; color: #C9D6D2; }
.side .foot { margin-top: auto; padding: 14px 16px 80px; border-top: 1px solid #2B4643; font-size: .82rem; color: #A9BDB8; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 28px; border-bottom: 1px solid var(--border); background: var(--canvas); position: sticky; top: 0; z-index: 20; }
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search input { width: 100%; padding-left: 40px; }
.topbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.fresh { display: inline-flex; align-items: center; gap: 8px; font-size: .87rem; color: var(--muted); white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--positive); display: inline-block; flex: none; }
.dot.warn { background: var(--warning); } .dot.err { background: var(--danger); } .dot.muted { background: #9AA8A3; }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); min-height: 48px; cursor: pointer; font: inherit; color: inherit; }
.me .who { text-align: left; line-height: 1.2; }
.me .who small { display: block; color: var(--muted); font-size: .78rem; }
/* Le contenu occupe toute la largeur libre (aucun conteneur centré à largeur maximale), barre ouverte ou repliée. */
.content { padding: 24px 28px 96px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs { font-size: .87rem; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.crumbs a { color: var(--muted); }

/* ---------- Bannières d'état ---------- */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-ctl); border: 1px solid; margin-bottom: 14px; }
.banner.err { background: var(--danger-tint); border-color: #E7B3B5; color: #6E1218; }
.banner.warn { background: var(--warning-tint); border-color: #E6CF95; color: #4E3700; }
.banner.info { background: var(--info-tint); border-color: var(--border-strong); }
.banner.ok { background: var(--positive-tint); border-color: #A9D2C7; color: #134A42; }
.banner .grow { flex: 1; }
.banner svg { flex: none; margin-top: 2px; }

/* ---------- Boutons, champs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--r-ctl); border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background var(--t); }
.btn:hover { background: #F0EEE7; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-press); }
.btn.outline-primary { border-color: var(--primary); color: var(--primary); }
.btn.danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #ECE9E0; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn.icon { padding: 0; width: 44px; }
.btn.sm.icon { width: 36px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.loading { pointer-events: none; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.lock::after { content: ""; }
input:not([type]), input[type=text], input[type=search], input[type=number], input[type=password], input[type=date], input[type=time], input[type=email], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-ctl); min-height: 44px; padding: 8px 12px; width: 100%; }
textarea { min-height: 88px; resize: vertical; }
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2353645F' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 16px 16px; padding-right: 2.5rem; text-overflow: ellipsis; }
select::-ms-expand { display: none; }
select:disabled { opacity: .6; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
label.f { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.field .help { font-size: .84rem; color: var(--muted); margin-top: 4px; }
.field .err { font-size: .86rem; color: var(--danger); margin-top: 4px; display: flex; gap: 6px; align-items: center; font-weight: 600; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.stack-s > * + * { margin-top: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-surf); }
.card > .hd > h2.grow { min-width: min(100%, 14ch); }
.card > .hd { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card > .bd { padding: 16px 18px; }
.card.flat { background: transparent; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-surf); margin-bottom: 16px; }
.kpi { display: flex; gap: 14px; align-items: center; padding: 16px 20px; text-decoration: none; color: inherit; border-right: 1px solid var(--border); min-height: 76px; }
.kpi:last-child { border-right: 0; }
.kpi:hover { background: #FBFAF6; }
.kpi .n { font-size: 1.7rem; font-weight: 800; line-height: 1; }
.kpi .t { font-weight: 700; }
.kpi .s { color: var(--muted); font-size: .85rem; }
.kpi.err .n, .kpi.err svg { color: var(--danger); }
.kpi.warn .n, .kpi.warn svg { color: var(--primary); }
.kpi.ok svg { color: var(--positive); }
.dl { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 8px 16px; font-size: .94rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.sep { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.two-col.even { grid-template-columns: 1fr 1fr; }
.two-col.sup { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
/* Les pistes 1fr gardent min-width:auto : un tableau large élargirait la page au lieu de défiler dans tbl-wrap. */
.shell > *, .grid2 > *, .grid3 > *, .two-col > *, .login-wrap > *, .main > .content { min-width: 0; }

/* ---------- Badges, chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: .84rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; line-height: 1.6; }
.badge.ok { background: var(--positive-tint); color: #1A5B51; }
.badge.warn { background: var(--warning-tint); color: var(--warning); }
.badge.err { background: var(--danger-tint); color: var(--danger); }
.badge.info { background: var(--info-tint); color: var(--ink); }
.badge.muted { background: #EEEDE8; color: var(--muted); }
.badge.svc { background: var(--primary-tint); color: #8A3214; }
.badge.svc.secu { background: var(--danger-tint); color: #8E1A22; }
.badge.svc.garde { background: #E7EEF6; color: #26476A; }
.badge.svc.chauffeur { background: #EEE9F5; color: #4A3470; }
.badge.lot { background: transparent; border-color: var(--border-strong); color: var(--muted); font-weight: 600; }
.badge .ico { width: 14px; height: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; text-decoration: none; }
.chip[aria-pressed="true"], .chip[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .n { font-size: .8rem; background: rgba(0,0,0,.08); padding: 0 7px; border-radius: 99px; }
.chip[aria-pressed="true"] .n, .chip[aria-current="page"] .n { background: rgba(255,255,255,.25); }
.chip.off { border-style: dashed; color: var(--muted); }

/* ---------- Tableaux ---------- */
.tbl-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.tbl-tools .q { position: relative; flex: 1 1 240px; max-width: 360px; }
.tbl-tools .q input { padding-left: 38px; }
.tbl-tools .q svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.tbl-tools select { width: auto; min-width: 150px; }
.tbl-wrap { overflow-x: auto; position: relative; } /* relative : les .sr absolus restent dans la zone défilante */
.badge.long { white-space: normal; border-radius: 10px; align-items: flex-start; }
.badge.long svg { flex: none; margin-top: 3px; }
table.t { width: 100%; border-collapse: collapse; font-size: .94rem; }
table.t th { text-align: left; font-weight: 700; font-size: .86rem; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: #FBFAF6; }
table.t th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; min-height: 28px; }
table.t th button:focus-visible { outline: 3px solid var(--ink); }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t td > a.b:first-child, table.t td.tnum, table.t td.mono { white-space: nowrap; }
table.t tbody tr.clk { cursor: pointer; }
table.t tbody tr.clk:hover td { background: #FBFAF6; }
table.t tbody tr.sel td { background: var(--primary-tint); }
table.t tbody tr.hl td { background: var(--danger-tint); }
/* Ligne mise en avant : fond teinté + pastille d’alerte dans la 1re cellule (jamais de liseré d’un seul côté). */
.hl-mark { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: var(--danger); color: #fff; margin-right: 4px; vertical-align: -3px; }
.hl-mark .ico { width: 11px; height: 11px; }
table.t td:has(> .hl-mark) { padding-left: 8px; }
table.t td:has(> .hl-mark + a.b) { white-space: nowrap; }
table.t tbody tr.cur td { background: #FFF6F1; }
table.t td.num, table.t th.num { text-align: right; white-space: nowrap; }
.tbl-foot { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: .88rem; color: var(--muted); flex-wrap: wrap; }
.tbl-foot .pager { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.selbar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--ink); color: #fff; flex-wrap: wrap; }
.selbar .btn { min-height: 38px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); margin: 10px 0 6px; }
.empty svg { color: var(--border-strong); }
.skel { background: linear-gradient(90deg, #EEEBE3 25%, #F6F4EE 50%, #EEEBE3 75%); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 8px; height: 14px; }
@keyframes sh { to { background-position: -200% 0; } }

/* ---------- Avatars ---------- */
.av { width: 40px; height: 40px; border-radius: 50%; background: #DCE4E1; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; flex: none; overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.lg { width: 64px; height: 64px; font-size: 1.2rem; }
.av.sm { width: 32px; height: 32px; font-size: .78rem; }
.who-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* ---------- Carte schématique ---------- */
.map { position: relative; background: #EAE7DC; border-radius: 0 0 var(--r-surf) var(--r-surf); overflow: hidden; aspect-ratio: 4 / 3.2; min-height: 300px; width: 100%; } /* largeur explicite : sinon min-height élargit la carte via le ratio */
.map svg.bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pin { position: absolute; transform: translate(-50%, -100%); border: 0; background: none; padding: 0; cursor: pointer; min-width: 44px; min-height: 44px; display: flex; align-items: flex-end; justify-content: center; }
.pin .p { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: flex; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.pin .p span { transform: rotate(45deg); color: #fff; font-weight: 800; font-size: .82rem; }
.pin.err .p { background: var(--danger); } .pin.warn .p { background: var(--primary); } .pin.ok .p { background: var(--positive); } .pin.info .p { background: #2F5E8C; } .pin.muted .p { background: #8C9893; }
.pin.partner .p { width: 22px; height: 22px; border-radius: 50%; transform: none; background: var(--surface); border: 3px solid var(--positive); }
.pin.partner.off .p { border-color: #8C9893; }
.pin.partner .p span { transform: none; }
.pin.static { cursor: default; }
.pin.sel .p { outline: 3px solid var(--ink); outline-offset: 2px; }
.pin.pulse .p::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid var(--danger); animation: pulse 1.6s infinite; }
@keyframes pulse { from { opacity: .9; transform: scale(.7); } to { opacity: 0; transform: scale(1.5); } }
.map .legend { position: absolute; left: 12px; right: 12px; bottom: 12px; background: rgba(255,255,255,.95); border-radius: 10px; padding: 8px 12px; display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; }
.map .legend span { display: inline-flex; gap: 6px; align-items: center; }
.map .note { position: absolute; top: 10px; left: 12px; background: rgba(255,255,255,.92); border-radius: 8px; padding: 4px 10px; font-size: .78rem; color: var(--muted); }
.map .stale { position: absolute; inset: 0; background: rgba(246,244,238,.55); display: flex; align-items: flex-start; justify-content: center; padding-top: 44px; pointer-events: none; }

/* ---------- File de supervision ---------- */
.q-item { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface); }
.q-item + .q-item { margin-top: 10px; }
.q-item.sos { background: #FDF3F3; border-color: #D98C91; }
.q-item.nomeca { background: #FDF7F2; border-color: #E2AE96; }
.q-item.pay { background: #FFFBF0; border-color: #DCC48A; }
.q-item .qg { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 6px 12px; align-items: start; }
.q-item .qg > .ic { grid-row: 1; padding-top: 2px; }
.q-item .qg > .act { grid-column: 3; grid-row: 1; text-align: right; }
.q-item .qg > .meta { grid-column: 2 / 4; margin-top: 0; }
.q-item .qg > .note { grid-column: 2 / 4; }
.q-item .ttl { font-weight: 800; font-size: 1.02rem; }
.q-item.sos .ttl { color: var(--danger); }
.q-item.nomeca .ttl { color: var(--primary); }
.q-item.pay .ttl { color: var(--warning); }
.q-item .meta { display: flex; gap: 6px 14px; flex-wrap: wrap; color: var(--muted); font-size: .88rem; margin-top: 6px; }
.q-item .meta span { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- Timeline ---------- */
.tl { list-style: none; padding: 0; margin: 0; }
.tl li { position: relative; padding: 0 0 14px 30px; }
.tl li::before { content: ""; position: absolute; left: 9px; top: 20px; bottom: -2px; width: 2px; background: var(--border); }
.tl li:last-child::before { display: none; }
.tl .m { position: absolute; left: 0; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); display: flex; align-items: center; justify-content: center; }
.tl .m.ok { background: var(--positive); border-color: var(--positive); color: #fff; }
.tl .m.warn { background: var(--warning-tint); border-color: var(--warning); color: var(--warning); }
.tl .m.err { background: var(--danger); border-color: var(--danger); color: #fff; }
.tl .m.info { background: var(--ink); border-color: var(--ink); color: #fff; }
.tl .w { font-weight: 600; }
.tl .s { font-size: .84rem; color: var(--muted); }
.tl .ev { font-family: ui-monospace, Menlo, monospace; font-size: .76rem; color: var(--muted); }

/* ---------- Drawer / modale ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 44, 43, .14); z-index: 60; }
.scrim.top { background: rgba(20, 44, 43, .36); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); z-index: 61; box-shadow: var(--shadow-overlay); display: flex; flex-direction: column; animation: slidein var(--t) ease-out; }
.drawer.wide { width: min(720px, 100vw); }
@keyframes slidein { from { transform: translateX(24px); opacity: .6; } }
.drawer > .hd { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer > .bd { padding: 18px 20px; overflow-y: auto; flex: 1; }
.drawer > .ft { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; flex-wrap: wrap; background: #FBFAF6; }
.modal { position: fixed; z-index: 71; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-overlay); }
.modal.wide { width: min(860px, calc(100vw - 32px)); }
.modal > .hd { padding: 18px 22px 8px; display: flex; gap: 12px; align-items: flex-start; }
.modal > .bd { padding: 8px 22px 16px; }
.modal > .ft { padding: 14px 22px 18px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.scrim.top { z-index: 70; }
.modal .ico-big { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.modal .ico-big.err { background: var(--danger-tint); color: var(--danger); }
.modal .ico-big.warn { background: var(--warning-tint); color: var(--warning); }
.modal .ico-big.ok { background: var(--positive-tint); color: var(--positive); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; max-width: min(440px, calc(100vw - 40px)); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-overlay); display: flex; gap: 10px; align-items: flex-start; font-size: .94rem; }
.toast.warn { background: #4E3700; } .toast.err { background: #6E1218; } .toast.info { background: #2B4643; }

/* ---------- Divers ---------- */
.doc-view { background: #2B3533; border-radius: 12px; padding: 16px; color: #fff; }
.doc-sheet { background: #fff; color: var(--ink); border-radius: 8px; aspect-ratio: 1.58; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; transition: transform var(--t); }
.doc-sheet .wm { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; transform: rotate(-18deg); font-weight: 800; font-size: 1.3rem; color: rgba(180,35,44,.16); text-align: center; pointer-events: none; }
.doc-sheet.blur > div:first-child { filter: blur(3px); }
.doc-thumb { width: 88px; height: 56px; border-radius: 8px; background: #EEECE5; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.prod-img { width: 56px; height: 56px; border-radius: 10px; background: #EEECE5; object-fit: cover; flex: none; display: flex; align-items: center; justify-content: center; color: var(--muted); border: 1px solid var(--border); overflow: hidden; }
.prod-img img { width: 100%; height: 100%; object-fit: cover; }
.prod-img.lg { width: 100%; height: 220px; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.kbd { display: inline-block; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; padding: 0 6px; font-family: ui-monospace, Menlo, monospace; font-size: .82rem; background: #fff; }
.price-lines { width: 100%; border-collapse: collapse; }
.price-lines td { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.price-lines td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 12px; }
.price-lines tr.tot td { border-bottom: 0; border-top: 2px solid var(--ink); font-weight: 800; font-size: 1.05rem; }
.pill-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.pill-tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; }
.pill-tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--primary); }
.conflict { border: 1px solid #E6CF95; background: var(--warning-tint); border-radius: 10px; padding: 8px 12px; font-size: .88rem; color: #4E3700; }
.cand { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.cand + .cand { margin-top: 8px; }
.cand.on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: #FFF9F6; }
.cand.no { background: #FAF9F5; color: var(--muted); }
.cand input[type=radio], .cand input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { background: var(--ink); color: #E8EEEC; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.login-form .card { width: min(440px, 100%); padding: 28px; }

/* Barre latérale repliée en rail d'icônes (ordinateur et tablette) : libellé en infobulle et en aria-label. */
.side-tg { flex: none; }
.shell.rail { --sidebar: 76px; }
.shell.rail .brand .l2, .shell.rail .brand .l3, .shell.rail .nav a .lbl, .shell.rail .side .foot .txt { display: none; }
.shell.rail .brand { padding: 18px 8px; text-align: center; }
.shell.rail .brand .l1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.shell.rail .brand .l0 { display: block; }
.shell.rail .nav a { justify-content: center; padding: 0; position: relative; }
.shell.rail .nav a .cnt { position: absolute; top: 4px; right: 6px; margin: 0; }
.nav-scrim { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1360px) {
  .two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 1180px) {
  .two-col, .two-col.even { grid-template-columns: 1fr; }
  .content { padding: 20px 20px 96px; }
  .topbar { padding: 10px 20px; }
}
@media (max-width: 760px) {
  html { font-size: 16px; }
  .shell { grid-template-columns: 1fr; }
  /* Mobile : la barre latérale devient un tiroir ouvert par le bouton menu. */
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); height: 100vh; z-index: 60; transform: translateX(-105%); visibility: hidden; transition: transform var(--t), visibility var(--t); box-shadow: var(--shadow-overlay); }
  .shell.nav-open .side { transform: none; visibility: visible; }
  .shell.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(20, 44, 43, .45); }
  .side .foot { padding-bottom: 20px; }
  .content { padding: 16px 16px 96px; }
  .topbar { padding: 8px 16px; flex-wrap: wrap; }
  .topbar .search { order: 3; flex-basis: 100%; max-width: none; }
  .me .who { display: none; }
  .grid2, .grid3, .two-col.sup { grid-template-columns: 1fr; }
  .kpi { border-right: 0; border-bottom: 1px solid var(--border); }
  h1 { font-size: 1.5rem; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  /* Devis A11 : une carte par ligne au lieu d'un tableau défilant */
  table.quote thead { display: none; }
  table.quote, table.quote tbody, table.quote tfoot { display: block; }
  table.quote tbody tr { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
  table.quote tbody td { display: block; padding: 0; border: 0; text-align: left; }
  table.quote tbody td:first-child { grid-column: 1 / -1; }
  table.quote tbody td[data-l]::before { content: attr(data-l); display: block; font-size: .8rem; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
  table.quote tbody td:last-child { align-self: end; }
  table.quote tbody td[data-line-total] { grid-column: 1 / 3; grid-row: 3; }
  table.quote tfoot tr { display: flex; justify-content: space-between; padding: 12px 0; }
  table.quote tfoot td { padding: 0; border: 0; }
  table.quote tfoot td:last-child:empty { display: none; }
  .toasts { bottom: 16px; right: 16px; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 8px; }
}
