/* Colis Express — back-office Travel By Green × CAMER-CO
   Idée directrice : le parcours du colis est une ligne (la « voie »). Elle revient sur le tableau de bord,
   la fiche colis et la page de suivi public. Le reste de l'interface reste calme. */

@font-face { font-family: 'Archivo'; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  src: url(../fonts/archivo-latin-ext.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Archivo'; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  src: url(../fonts/archivo-latin.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --ink: #12261f;
  --ink-soft: #52665e;
  --ink-faint: #8a9b94;
  --line: #d9e1dd;
  --canvas: #edf1ef;
  --surface: #ffffff;
  --side: #0c2a22;
  --side-ink: #c9dcd4;
  --route: #0f6b4f;          /* vert Travel By Green : action principale */
  --route-soft: #dff0e8;
  --hivis: #ff6a1f;          /* gilet haute visibilité : ce qui demande l'attention */
  --hivis-soft: #ffe6d8;
  --sky: #2b6cd9;            /* colis en mouvement */
  --sky-soft: #e0eafb;
  --amber: #b98100;
  --amber-soft: #fbefcf;
  --red: #c42a3c;
  --red-soft: #fbe0e3;
  --slate: #6b7c76;
  --slate-soft: #e4eae7;
  --r-panel: 10px; --r-ctl: 6px;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--canvas); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-stretch: 72%; font-weight: 750; letter-spacing: 0.005em; line-height: 1.1; margin: 0; }
h1 { font-size: 2rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; }
p { margin: 0 0 .6em; }
a { color: var(--route); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--hivis); outline-offset: 2px; border-radius: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-soft); } .faint { color: var(--ink-faint); } .right { text-align: right; } .nowrap { white-space: nowrap; }
.num { font-stretch: 72%; font-weight: 800; }
.hidden { display: none !important; }

/* ---------- Disposition ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; }
.brand svg { flex: none; }
.brand b { font-stretch: 70%; font-weight: 800; font-size: 1.35rem; line-height: 1; display: block; }
.brand span { font-size: .74rem; color: var(--side-ink); white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.nav h4 { font-stretch: 100%; font-weight: 500; font-size: .78rem; color: #7fa093; padding: 8px 12px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; color: var(--side-ink); text-decoration: none; border-radius: var(--r-ctl); position: relative; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.nav a[aria-current="page"]::before { content: ''; position: absolute; left: -12px; top: 6px; bottom: 6px; width: 4px; border-radius: 0 3px 3px 0; background: var(--hivis); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav .badge { margin-left: auto; background: var(--hivis); color: #fff; font-size: .72rem; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top .search { flex: 1; max-width: 520px; position: relative; }
.top .search input { width: 100%; padding: 9px 12px 9px 38px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--canvas); }
.top .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-faint); }
.top .spacer { flex: 1; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--ink-soft); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
.live.on i { background: #1fb36b; }
.who { text-align: right; line-height: 1.2; } .who b { font-weight: 600; display: block; } .who span { font-size: .8rem; color: var(--ink-soft); }
.page { padding: 26px 28px 60px; max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .grow { flex: 1; min-width: 220px; }
.page-head p { margin: 6px 0 0; color: var(--ink-soft); }
.btn.menu-btn { display: none; }

/* ---------- Composants ---------- */
.panel { background: var(--surface); border-radius: var(--r-panel); padding: 18px 20px; margin-bottom: 18px; }
.panel > h2, .panel > h3, .panel-head h2, .panel-head h3 { margin-bottom: 12px; }
.panel-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.panel-head h2, .panel-head h3 { margin: 0 0 10px; }
.panel-head .spacer { flex: 1; }
.cols { display: grid; gap: 18px; }
.cols.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols.main-side { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); line-height: 1.2; }
.btn:hover { border-color: var(--ink-faint); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--route); border-color: var(--route); color: #fff; }
.btn.primary:hover { background: #0b5a42; }
.btn.alert { background: var(--hivis); border-color: var(--hivis); color: #fff; }
.btn.danger { color: var(--red); border-color: #e6b8bf; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--route); }
.btn.sm { padding: 4px 9px; font-size: .86rem; }
.btn svg { width: 16px; height: 16px; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .field > .lbl { font-size: .86rem; font-weight: 600; color: var(--ink-soft); }
.field input, .field select, .field textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: #fff; width: 100%; min-height: 38px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--route); outline-offset: 0; border-color: var(--route); }
.field .hint { font-size: .8rem; color: var(--ink-faint); }
.field .err { font-size: .82rem; color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-ctl); cursor: pointer; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--route); flex: none; }
.check:has(input:checked) { background: var(--route-soft); border-color: #a8d5c2; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { min-width: 150px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: .82rem; font-weight: 600; background: var(--slate-soft); color: #3d4f48; white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .75; }
.pill.pre { background: var(--slate-soft); color: #3d4f48; }
.pill.move { background: var(--sky-soft); color: #1e4fa6; }
.pill.done { background: var(--route-soft); color: #0b5a42; }
.pill.warn { background: var(--amber-soft); color: #7a5600; }
.pill.bad { background: var(--red-soft); color: #9a1c2c; }
.pill.hot { background: var(--hivis-soft); color: #b24100; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-weight: 600; font-size: .84rem; color: var(--ink-soft); padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.t td { padding: 9px 10px; border-bottom: 1px solid #edf1ef; vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t.click tbody tr { cursor: pointer; }
table.t.click tbody tr:hover td { background: #f6f9f7; }
table.t td.num-cell, table.t th.num-cell { text-align: right; }
.tracking { white-space: nowrap; font-stretch: 75%; font-weight: 700; letter-spacing: .02em; font-size: 1.02em; }
.tablewrap { overflow-x: auto; }
.empty { padding: 28px 12px; text-align: center; color: var(--ink-soft); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; font-size: 1.05rem; }

/* ---------- La voie (parcours du colis) ---------- */
.rail { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); position: relative; padding: 6px 0 4px; }
.rail::before { content: ''; position: absolute; left: calc(100% / 18); right: calc(100% / 18); top: 33px; height: 4px; background: var(--slate-soft); border-radius: 2px; }
.rail .stop { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; position: relative; background: none; border: 0; padding: 0; cursor: default; color: inherit; }
button.stop { cursor: pointer; }
.rail .node { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 4px solid var(--slate-soft); font-stretch: 70%; font-weight: 800; font-size: 1.25rem; color: var(--ink-faint); position: relative; z-index: 1; }
.rail .stop.has .node { color: #fff; border-color: transparent; }
.rail .stop.has.pre .node { background: var(--slate); }
.rail .stop.has.move .node { background: var(--sky); }
.rail .stop.has.done .node { background: var(--route); }
button.stop:hover .node { outline: 3px solid var(--hivis-soft); }
.rail .lbl { font-size: .8rem; line-height: 1.15; color: var(--ink-soft); max-width: 92px; }
.rail .stop.has .lbl { color: var(--ink); font-weight: 600; }
.rail.single .node { width: 36px; height: 36px; font-size: 1rem; border-width: 3px; }
.rail.single::before { top: 23px; }
.rail.single .stop.past .node { background: var(--route); border-color: transparent; color: #fff; }
.rail.single .stop.now .node { background: var(--hivis); border-color: var(--hivis-soft); color: #fff; box-shadow: 0 0 0 4px var(--hivis-soft); }
.rail.single .stop.now .lbl { color: var(--ink); font-weight: 700; }
.rail.single .stop.past .lbl { color: var(--ink); }
.exceptions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.exceptions button.pill { border: 0; cursor: pointer; font-family: inherit; }

/* ---------- Indicateurs ---------- */
.ledger { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px 26px; }
.ledger .k b { display: block; font-stretch: 68%; font-weight: 800; font-size: 2.3rem; line-height: 1; letter-spacing: .005em; }
.ledger .k b small { font-size: .5em; font-weight: 600; color: var(--ink-soft); margin-left: 3px; }
.ledger .k span { color: var(--ink-soft); font-size: .88rem; display: block; margin-top: 5px; }
.ledger .k.hot b { color: var(--hivis); }

.bar { height: 8px; background: var(--slate-soft); border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--route); border-radius: 4px; }
.bar.warn > i { background: var(--amber); } .bar.full > i { background: var(--hivis); }
.minibars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.minibars > div { flex: 1; min-width: 4px; max-width: 44px; background: var(--route); border-radius: 3px 3px 0 0; position: relative; }
.minibars > div:hover { background: var(--hivis); }
.axis { display: flex; justify-content: space-between; font-size: .78rem; color: var(--ink-faint); margin-top: 4px; }

/* Tableau des vols (esprit tableau des départs) */
.board { display: grid; gap: 0; }
.board .flt { display: grid; grid-template-columns: 76px 1fr 130px 90px; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid #edf1ef; cursor: pointer; }
.board .flt:last-child { border-bottom: 0; }
.board .flt .no { font-stretch: 68%; font-weight: 800; font-size: 1.5rem; }
.board .flt .when { text-align: right; font-stretch: 75%; font-weight: 700; }
.board .flt:hover .no { color: var(--route); }

/* ---------- Chronologie ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: -4px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ''; position: absolute; left: 0; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--route); border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--route); }
.timeline li.exc::after { background: var(--hivis); box-shadow: 0 0 0 2px var(--hivis); }
.timeline li.last::after { box-shadow: 0 0 0 2px var(--hivis); background: var(--hivis); }
.timeline b { display: block; font-weight: 650; }
.timeline small { color: var(--ink-soft); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.facts dt { color: var(--ink-soft); font-size: .9rem; } dl.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.photos { display: flex; gap: 10px; flex-wrap: wrap; }
.photos a { display: block; width: 96px; height: 96px; border-radius: 8px; overflow: hidden; background: var(--slate-soft); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 9px 14px; cursor: pointer; font-weight: 600; color: var(--ink-soft); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--hivis); }

.notice { padding: 10px 14px; border-radius: var(--r-ctl); background: var(--amber-soft); color: #5e4400; margin-bottom: 14px; }
.notice.bad { background: var(--red-soft); color: #7c1424; } .notice.good { background: var(--route-soft); color: #0b4e39; } .notice.info { background: var(--sky-soft); color: #173f86; }

/* ---------- Fenêtres et messages ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8, 26, 20, .55); display: grid; place-items: start center; padding: 6vh 16px; overflow-y: auto; z-index: 50; }
.modal { background: var(--surface); border-radius: 12px; width: min(560px, 100%); padding: 22px 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { width: min(820px, 100%); }
.modal h2 { margin-bottom: 14px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; max-width: 380px; animation: pop .18s ease-out; }
.toast.bad { background: var(--red); } .toast.good { background: var(--route); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.spinner { width: 22px; height: 22px; border: 3px solid var(--slate-soft); border-top-color: var(--route); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 5fr) minmax(360px, 4fr); }
.login .art { background: var(--side); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.login .art h1 { font-size: clamp(2.6rem, 5vw, 4.2rem); font-stretch: 64%; font-weight: 800; max-width: 11ch; }
.login .art p { color: var(--side-ink); max-width: 38ch; }
.login .art .mini { display: grid; grid-template-columns: repeat(5, 1fr); position: relative; max-width: 520px; }
.login .art .mini::before { content: ''; position: absolute; left: 10%; right: 10%; top: 9px; height: 3px; background: #29544a; }
.login .art .mini span { text-align: center; font-size: .78rem; color: var(--side-ink); position: relative; padding-top: 28px; }
.login .art .mini span::before { content: ''; position: absolute; left: 50%; top: 0; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; background: var(--side); border: 3px solid #4f9a80; }
.login .art .mini span:nth-child(3)::before { border-color: var(--hivis); background: var(--hivis); }
.login .form { display: grid; place-items: center; padding: 32px; background: var(--surface); }
.login form { width: min(380px, 100%); }
.login form h2 { margin-bottom: 18px; font-size: 1.8rem; }

@media (max-width: 1100px) { .cols.main-side, .cols.three { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; z-index: 60; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .btn.menu-btn { display: inline-flex; }
  .page { padding: 18px 14px 50px; } .top { padding: 10px 14px; }
  .cols.two { grid-template-columns: minmax(0, 1fr); }
  .rail { grid-template-columns: 1fr; gap: 6px; } .rail::before { display: none; }
  .rail .stop { flex-direction: row; text-align: left; } .rail .lbl { max-width: none; }
  .login { grid-template-columns: 1fr; } .login .art { padding: 28px; }
  .who { display: none; }
  .top { gap: 8px; } .top .search { min-width: 0; } .top .btn-text, .top .live span { display: none; }
  .top .search input { min-width: 0; } .top .spacer { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .side, .top, .btn, .tabs { display: none !important; } .shell { display: block; } body { background: #fff; } }
