/* ==========================================================================
   COMPTOIR 7 — socle commun (site, portail revendeur, gestion, appli du patron)
   Projet concept Démesure. Bleu dépôt, kraft, carton, papier, encre ; un orange
   « signal » pour ce qui demande une action. On compte juste.
   ========================================================================== */

:root {
  --depot: #1f3a5f;
  --depot-2: #2a4a75;
  --depot-3: #15293f;
  --kraft: #c79a5b;
  --kraft-2: #a87a42;
  --carton: #e9dcc6;
  --carton-2: #ddccb0;
  --paper: #f6f3ee;
  --white: #fffdf9;
  --ink: #121417;
  --ink-2: #3d4248;
  --ink-3: #6f747b;
  --line: #e2dbcf;
  --line-2: #cfc6b6;
  --signal: #ff6a13;
  --signal-2: #e85a06;
  --signal-soft: #ffe4d2;
  --ok: #2e9e5b;
  --ok-soft: #d9f0e2;
  --warn: #e3a21a;
  --warn-soft: #fbedc8;
  --red: #c63b2b;
  --red-soft: #f7dcd7;
  --t1: #3b7dd8;
  --t2: #ff6a13;
  --t3: #2a9d8f;

  --display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --ui: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ar: "IBM Plex Sans Arabic", "Inter Tight", system-ui, sans-serif;
  --ar-display: "Amiri", "IBM Plex Sans Arabic", serif;

  --r: 14px;
  --r-sm: 9px;
  --shadow: 0 1px 0 rgba(18, 20, 23, .04), 0 12px 30px -18px rgba(18, 20, 23, .32);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --spring: cubic-bezier(.2, 1.35, .4, 1);

  /* Couche Démesure (bandeau, bascule, explications) */
  --p-ink: #0b0b0a;
  --p-ink-2: #151513;
  --p-bone: #ebe8df;
  --p-dim: rgba(235, 232, 223, .64);
  --p-faint: rgba(235, 232, 223, .3);
  --p-rule: rgba(235, 232, 223, .14);
  --p-acc: #ff4a1c;
  --p-serif: "Instrument Serif", "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--ui); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
p { margin: 0; }
[hidden] { display: none !important; }
svg use { pointer-events: none; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Lettrage d'étiquette de carton : Archivo très étroit, gras, en capitales */
.stencil { font-family: var(--display); font-stretch: 66%; font-weight: 800; text-transform: uppercase; letter-spacing: -.005em; line-height: .9; }
.kicker { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }

/* Ruban « chantier » : fine bande jaune et noire (À valider, avertissements) */
.hazard { background: repeating-linear-gradient(-45deg, var(--warn) 0 7px, var(--ink) 7px 14px); }

/* ---------- Bandeau « projet concept » (couche Démesure) ------------------------ */
.demo-bar { position: relative; z-index: 60; display: flex; align-items: center; justify-content: space-between; gap: 4px 16px; padding: 7px 16px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); background: var(--p-ink); color: var(--p-dim); font-size: 12.5px; line-height: 1.45; }
.demo-bar > span:first-child { flex: 1; min-width: 0; }
.demo-bar b { color: var(--p-bone); font-weight: 600; }
.demo-bar a { color: var(--p-acc); text-underline-offset: 3px; }
.demo-bar__links { display: flex; flex-wrap: wrap; gap: 2px 16px; }
.demo-bar__short { display: none; }
@media (max-width: 600px) {
  .demo-bar { flex-wrap: nowrap; padding-top: 6px; padding-bottom: 6px; font-size: 12px; }
  .demo-bar > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .demo-bar__long { display: none; }
  .demo-bar__short { display: inline; }
  .demo-bar__links { flex-wrap: nowrap; white-space: nowrap; }
}

/* ---------- Bascule « Site revendeur | Gestion dépôt » (couche Démesure) ------------ */
.pmode { position: fixed; z-index: 75; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 3px; padding: 4px; border-radius: 999px; background: rgba(11, 11, 10, .9); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(235, 232, 223, .12); font-family: var(--ui); transition: bottom .4s var(--ease), opacity .4s; max-width: calc(100vw - 24px); }
.pmode a { display: grid; place-items: center; height: 38px; padding: 0 16px; border-radius: 999px; color: var(--p-dim); font-size: 13px; font-weight: 600; white-space: nowrap; text-decoration: none; transition: background-color .25s, color .25s; }
.pmode a:hover { color: var(--p-bone); }
.pmode a[aria-current="page"] { background: var(--p-bone); color: var(--p-ink); }
.pmode a:not([aria-current]) { color: var(--p-acc); }
@media (max-width: 560px) { .pmode a { padding: 0 14px; font-size: 12.5px; } }

/* ---------- Logo : pictogramme carton + « COMPTOIR 7 » étroit ----------------------- */
.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: inherit; }
.logo-mark { width: 34px; height: 34px; flex: none; }
.logo__word { display: flex; flex-direction: column; font-family: var(--display); font-stretch: 64%; font-weight: 800; font-size: 25px; line-height: .86; letter-spacing: .01em; }
.logo__name { white-space: nowrap; }
.logo__name b { margin-left: .14em; color: var(--signal); font-weight: 800; }
.logo__word small { display: block; margin-top: 4px; font-family: var(--ui); font-stretch: 100%; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .7; line-height: 1; }

/* ---------- Boutons ------------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--white); color: var(--ink); font-weight: 650; font-size: 14.5px; text-decoration: none; white-space: nowrap; transition: background-color .2s, border-color .2s, color .2s, transform .2s var(--ease), box-shadow .2s; }
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(.98); }
.btn--signal { background: var(--signal); border-color: var(--signal); color: #fff; box-shadow: 0 10px 24px -12px rgba(255, 106, 19, .8); }
.btn--signal:hover { background: var(--signal-2); border-color: var(--signal-2); }
.btn--depot { background: var(--depot); border-color: var(--depot); color: #fff; }
.btn--depot:hover { background: var(--depot-3); border-color: var(--depot-3); }
.btn--ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--ghost { background: transparent; }
.btn--lg { min-height: 54px; padding: 0 24px; font-size: 16px; border-radius: 12px; }
.btn--sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn--block { display: flex; width: 100%; }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.btn .i { width: 18px; height: 18px; }

/* ---------- Pastilles d'état --------------------------------------------------------- */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 6px; background: var(--carton); color: var(--ink-2); font-size: 12px; font-weight: 650; white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.tag--ok { background: var(--ok-soft); color: #1f7443; }
.tag--warn { background: var(--warn-soft); color: #8a5c00; }
.tag--red { background: var(--red-soft); color: #9e2a1d; }
.tag--signal { background: var(--signal-soft); color: #b6460a; }
.tag--depot { background: #dde5ef; color: var(--depot); }
.tag--plain::before { display: none; }

/* ---------- Cartes, avatars ------------------------------------------------------------ */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.av { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--carton); color: var(--depot); font-family: var(--display); font-stretch: 70%; font-weight: 800; font-size: 15px; }

/* ---------- Cartons isométriques (art.js) ------------------------------------------------ */
.pallet, .carton { overflow: visible; }
.ctn.is-new { animation: ctn-drop .55s var(--spring) both; }
@keyframes ctn-drop { 0% { transform: translateY(-42px); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; opacity: 1; } }

/* ---------- Carte des tournées (art.js) --------------------------------------------------- */
.routemap { width: 100%; height: auto; }
.routemap text { font-family: var(--ui); }
.rm-sea { font-family: var(--mono) !important; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; fill: rgba(31, 58, 95, .5); }
.rm-city { font-size: 10px; fill: rgba(18, 20, 23, .38); font-style: italic; }
.rm-label { font-size: 12.5px; font-weight: 650; fill: var(--ink); paint-order: stroke; stroke: var(--map-land, #efe9df); stroke-width: 4px; stroke-linejoin: round; }
.rm-dlabel { font-family: var(--mono) !important; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; fill: var(--depot); paint-order: stroke; stroke: var(--map-land, #efe9df); stroke-width: 4px; }
.rm-seven { font-family: var(--display) !important; font-stretch: 66%; font-weight: 800; font-size: 16px; fill: var(--signal); }
.rm-tno { font-family: var(--display) !important; font-stretch: 66%; font-weight: 800; font-size: 11px; fill: #fff; }
.rm-path { animation: rm-dash 1.6s linear infinite; }
@keyframes rm-dash { to { stroke-dashoffset: -16; } }
.rm-loop { transition: opacity .35s; }
.rm-loop.is-dim, .rm-com.is-dim { opacity: .28; }
.rm-loop.is-active .rm-path { stroke-width: 4; stroke-dasharray: none; animation: none; }
.rm-com { cursor: pointer; outline: none; transition: opacity .35s; }
.rm-com:focus-visible circle:nth-child(2) { stroke-width: 4; }
.rm-com.is-here circle:nth-child(2) { r: 7; fill: var(--signal); }

/* ---------- Notifications (toasts) ----------------------------------------------------------- */
.toast-stack { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; max-width: calc(100vw - 32px); }
.toast { display: flex; gap: 10px; align-items: flex-start; max-width: min(380px, calc(100vw - 32px)); padding: 12px 14px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .5); font-size: 14px; line-height: 1.38; pointer-events: auto; animation: toast-in .5s var(--ease); }
.toast b { display: block; margin-bottom: 2px; }
.toast small { display: block; color: rgba(255, 255, 255, .66); }
.toast a { color: #ffb48a; font-weight: 650; }
.toast__dot { flex: none; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--signal); }
.toast.is-out { opacity: 0; transform: translateY(8px); transition: opacity .35s, transform .35s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* Surbrillance de ce qui vient d'arriver */
.is-new-flash { animation: flash 2.4s var(--ease); }
@keyframes flash { 0%, 30% { background-color: var(--signal-soft); box-shadow: 0 0 0 3px rgba(255, 106, 19, .35); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Carte dessinée affichée petite (téléphone, appli du patron) : les textes grossissent pour rester lisibles */
.tmap__map, .map, .zones__map { container-type: inline-size; }
@container (max-width: 560px) {
  .rm-label { font-size: 20px; stroke-width: 6px; }
  .rm-dlabel, .rm-sea { font-size: 15px; }
  .rm-city { display: none; }
  .rm-tno { font-size: 17px; }
  .rm-truck circle { r: 13px; }
  .rm-truck text { transform: translateY(2.5px); }
  .rm-com circle:nth-child(2) { r: 7px; }
}
