/* Compléments communs des plateformes m2m.ma, par-dessus les styles de my.m2m.ma. */
.space-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .45rem clamp(1rem, 3vw, 2.4rem); background: var(--brand); color: var(--brand-ink); }
.space-links { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; min-width: 0; }
.space-links a { color: inherit; text-decoration: none; padding: .35rem .7rem; border-radius: 99px; font-size: .88rem; opacity: .85; min-height: 36px; display: inline-flex; align-items: center; }
.space-links a.on { background: rgba(255, 255, 255, .18); opacity: 1; font-weight: 600; }
.space-bar select { width: auto; min-height: 36px; margin: 0; background: rgba(255, 255, 255, .12); color: inherit; border-color: rgba(255, 255, 255, .35); }
.space-bar select option { color: #1d2a26; }
.company-name { font-size: .9rem; }
.app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100dvh - 50px); }
.app-nav { background: var(--surface); border-inline-end: 1px solid var(--line); padding: 1rem .6rem; display: flex; flex-direction: column; gap: .2rem; }
.app-nav .app-title { font-weight: 700; color: var(--brand); padding: .2rem .6rem .7rem; }
.app-nav a { display: flex; align-items: center; gap: .6rem; min-height: 42px; padding: .4rem .6rem; border-radius: 9px; color: inherit; text-decoration: none; font-weight: 500; }
.app-nav a:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.app-nav a.on { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); font-weight: 600; }
.app-nav svg { width: 21px; height: 21px; flex: none; opacity: .8; }
.app-main { padding: 1.4rem clamp(1rem, 3vw, 2.4rem) 6rem; min-width: 0; }
.brand-logo { display: block; height: 40px; width: auto; margin-bottom: .8rem; }
.scan-box { display: flex; gap: .5rem; align-items: stretch; flex-wrap: wrap; }
.scan-box input { flex: 1; min-width: 12rem; margin: 0; font-size: 1.05rem; }
.scan-box button { margin: 0; }
.scan-hint { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .85rem; margin-top: .4rem; }
.scan-hint i { width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px var(--good-soft); }
.camera { width: 100%; max-height: 50vh; border-radius: 10px; background: #000; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-wrap .bar-in { fill: var(--income); } .chart-wrap .bar-out { fill: var(--expense); }
.chart-wrap .axis { stroke: var(--line); } .chart-wrap .tick { fill: var(--muted); font-size: 11px; }
.chart-wrap .hit { fill: transparent; }
.chart-wrap .hit:hover, .chart-wrap .hit:focus { fill: color-mix(in srgb, var(--brand) 8%, transparent); outline: none; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: .3rem; }
.hbars { display: grid; gap: .45rem; }
.hbars .hb { display: grid; grid-template-columns: minmax(0, 10rem) minmax(0, 1fr) auto; gap: .6rem; align-items: center; font-size: .9rem; }
.hbars .hb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars .hb i { display: block; height: 10px; border-radius: 0 4px 4px 0; background: var(--brand); width: var(--v); min-width: 2px; }
.status { display: inline-block; padding: .05rem .5rem; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--line); }
.status.prepare { background: var(--warn-soft); color: var(--warn); } .status.expedie, .status.en_livraison { background: var(--brand-soft); color: var(--brand); }
.status.livre { background: var(--good-soft); color: var(--good); } .status.retourne, .status.annule { background: var(--bad-soft); color: var(--bad); }
.timeline { list-style: none; margin: 0; padding: 0; border-inline-start: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 .9rem 1.1rem; }
[dir="rtl"] .timeline li { padding: 0 1.1rem .9rem 0; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -7px; top: .35rem; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); }
.label-preview { background: #fff; color: #000; border: 1px solid var(--line); border-radius: 8px; padding: .8rem; max-width: 380px; }
.label-preview .barcode { width: 100%; height: auto; }
.tracking-page { max-width: 640px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

/* Assistant */
.assistant { position: fixed; inset-inline-end: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 45; }
.assistant [hidden] { display: none; }
.assistant-open { display: flex; align-items: center; gap: .45rem; min-height: 50px; padding: .5rem 1.05rem; border: 0; border-radius: 99px; background: var(--brand); color: var(--brand-ink); font-weight: 650; box-shadow: 0 10px 28px rgba(15, 76, 65, .35); }
.assistant-open svg { width: 22px; height: 22px; }
.assistant-panel { display: flex; flex-direction: column; width: min(390px, calc(100vw - 32px)); height: min(560px, calc(100dvh - 96px)); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 18px 50px rgba(0, 0, 0, .25); }
.assistant-head { display: flex; align-items: center; justify-content: space-between; padding: .3rem .4rem .3rem 1rem; background: var(--brand); color: var(--brand-ink); }
.assistant-close { width: 44px; height: 44px; border: 0; background: none; color: inherit; font-size: 1.5rem; }
.assistant-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; padding: .8rem; background: var(--paper); }
.assistant-msg { margin: 0; padding: .5rem .75rem; max-width: 88%; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .93rem; }
.assistant-msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.assistant-msg.me { align-self: flex-end; background: var(--brand); color: var(--brand-ink); }
.assistant-msg.wait { color: var(--muted); font-style: italic; }
.assistant-form { display: flex; gap: .4rem; padding: .55rem; border-top: 1px solid var(--line); }
.assistant-form input { flex: 1; min-width: 0; margin: 0; font-size: 16px; }
.assistant-form button { margin: 0; }
.assistant-note { margin: 0; padding: 0 .7rem .55rem; color: var(--muted); font-size: .75rem; line-height: 1.35; }

@media (max-width: 820px) {
  .app-shell { display: block; }
  .app-nav { flex-direction: row; overflow-x: auto; padding: .4rem .6rem; border-inline-end: 0; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  .app-nav .app-title { display: none; }
  .app-nav a { white-space: nowrap; flex: none; }
  .space-links { flex-wrap: nowrap; overflow-x: auto; flex-basis: 100%; }
  .space-links a { white-space: nowrap; }
  .hbars .hb { grid-template-columns: minmax(0, 7rem) minmax(0, 1fr) auto; }
}
@media print { .space-bar, .app-nav, .assistant { display: none !important; } .app-shell { display: block; } }
