/* Lucy MSK Cargo — interface agents. Mobile d'abord, aucune dépendance externe. */
:root {
  --navy: #0b2a55;
  --navy-2: #123a70;
  --orange: #f28c1b;
  --orange-dark: #c96d08;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --line: #dde3ec;
  --text: #16223a;
  --muted: #5e6b82;
  --green: #1f8a4c;
  --red: #c0392b;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--navy-2); }
img { max-width: 100%; height: auto; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; line-height: 1.2; text-wrap: balance; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; }
.num { font-variant-numeric: tabular-nums; }

/* En-tête */
.topbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .02em; display: flex; align-items: center; gap: .5rem; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; background: var(--orange); display: grid; place-items: center; color: var(--navy); font-weight: 800; font-size: .8rem; }
.office-pill { font-size: .8rem; background: rgba(255,255,255,.14); padding: .15rem .55rem; border-radius: 99px; }
.topbar .spacer { flex: 1; }
.topbar .tools { display: flex; align-items: center; gap: .6rem; font-size: .875rem; }
.topbar .tools a { color: #cfdcf0; text-decoration: none; }
.topbar .tools a:hover, .topbar .tools a.active { color: #fff; }
.nav { background: var(--navy-2); }
.nav-inner { max-width: 1100px; margin: 0 auto; padding: 0 .5rem; display: flex; gap: .25rem; overflow-x: auto; }
.nav a { color: #cfdcf0; text-decoration: none; padding: .7rem .8rem; white-space: nowrap; border-bottom: 3px solid transparent; font-weight: 500; }
.nav a.active { color: #fff; border-bottom-color: var(--orange); }

main { max-width: 1100px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }

/* Blocs */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 820px) { .grid-2 { grid-template-columns: 1.4fr 1fr; } }
.tiles { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem; text-decoration: none; color: inherit; display: block; }
.tile:hover { border-color: var(--navy-2); }
.tile .n { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .l { color: var(--muted); font-size: .85rem; }
.tile.hot { border-color: var(--orange); background: #fff8ef; }

/* Listes */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.row-link { display: flex; gap: .75rem; align-items: center; padding: .7rem .25rem; color: inherit; text-decoration: none; }
.row-link:hover { background: #f7f9fc; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { text-align: right; flex: none; }
.thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: #e8edf4; flex: none; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

.dl { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: .45rem .75rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Badges de statut */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge.gray { background: #e8ecf2; color: #3f4a5e; }
.badge.blue { background: #dfe9fb; color: #1d4c9c; }
.badge.sky { background: #dcf1fb; color: #0b6284; }
.badge.orange { background: #ffe8cf; color: #8d4b00; }
.badge.green { background: #dbf2e3; color: #17663a; }
.badge.red { background: #fbe0dd; color: #962d22; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .65rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; min-height: 44px; }
.btn:hover { border-color: var(--navy-2); }
.btn-primary { background: var(--orange); border-color: var(--orange); color: #241300; }
.btn-primary:hover { background: var(--orange-dark); border-color: var(--orange-dark); color: #fff; }
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-whatsapp { background: #1fa855; border-color: #1fa855; color: #fff; }
.btn-whatsapp:hover { background: #178a45; }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: .35rem .7rem; font-size: .875rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* Formulaires */
form .form-grid { display: grid; gap: .9rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { form .form-grid.cols-2 { grid-template-columns: 1fr 1fr; } form .span-2 { grid-column: 1 / -1; } }
.form-grid-3 { display: grid; gap: .5rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
label, legend { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .92rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: .65rem .7rem; border: 1px solid #c5cedb; border-radius: 8px; font: inherit; background: #fff; color: var(--text); min-height: 44px;
}
textarea { min-height: 70px; }
input[type=file] { width: 100%; font: inherit; }
input[type=radio], input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--orange); vertical-align: middle; }
fieldset { border: 0; padding: 0; margin: 0; }
.radio-row > div, form div[id$="_mode"] { display: flex; gap: 1rem; flex-wrap: wrap; }
form div[id$="_mode"] label { display: inline; font-weight: 500; margin: 0 0 0 .3rem; }
.help-text, .form-help, .help-block { color: var(--muted); font-size: .82rem; margin-top: .25rem; }
ul.form-errors, .form-error ul, div > ul:has(> li) { color: var(--red); }
.form-error-message { color: var(--red); }
.searchbar { display: flex; gap: .5rem; flex-wrap: wrap; }
.searchbar input[type=search] { flex: 1 1 220px; }
.searchbar select { flex: 0 1 180px; width: auto; }

/* Messages */
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: .75rem; border: 1px solid; }
.flash-success { background: #e8f6ee; border-color: #b5e0c5; color: #155c33; }
.flash-error { background: #fdecea; border-color: #f3c1bb; color: #8a241a; }
.flash-warning { background: #fff5e6; border-color: #f6d4a4; color: #7a4400; }
.callout { background: #fff8ef; border: 1px solid #f6d4a4; border-radius: var(--radius); padding: 1rem; }

/* Historique */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1rem .6rem; }
.timeline li::before { content: ""; position: absolute; left: -1.53rem; top: .3rem; width: 12px; height: 12px; border-radius: 50%; background: var(--orange); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--orange); }

/* Code de suivi */
.code-box { font: 700 1.5rem/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; background: var(--navy); color: #fff; padding: .6rem .9rem; border-radius: 8px; display: inline-block; }

/* Suivi public */
.public { min-height: 100vh; background: linear-gradient(180deg, var(--navy) 0 240px, var(--bg) 240px); }
.public main { max-width: 640px; }
.public-head { color: #fff; padding: 1.5rem 1rem 1rem; max-width: 640px; margin: 0 auto; }
.public-head h1 { font-size: 1.6rem; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.steps li { display: flex; align-items: center; gap: .7rem; color: var(--muted); }
.steps .dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #c5cedb; display: grid; place-items: center; flex: none; font-size: .8rem; font-weight: 700; background: #fff; }
.steps li.done { color: var(--text); }
.steps li.done .dot { background: var(--orange); border-color: var(--orange); color: #241300; }
.steps li.current { font-weight: 700; }

/* Choix de la langue */
.lang-switch { display: flex; gap: .25rem; font-size: .875rem; }
.lang-switch a { color: #cfdcf0; text-decoration: none; padding: .2rem .45rem; border-radius: 6px; font-weight: 600; }
.lang-switch a:hover, .lang-switch a.active { color: #fff; background: rgba(255,255,255,.14); }

/* Coin haut droit : langue + bouton de connexion */
.header-tools { display: flex; align-items: center; gap: .75rem; }
.header-login { color: var(--navy); background: var(--orange); text-decoration: none; font-weight: 700; font-size: .875rem; padding: .4rem .85rem; border-radius: 8px; white-space: nowrap; }
.header-login:hover { background: #fff; color: var(--navy); }
.header-login i { font-style: normal; }

/* Connexion */
.login-wrap { max-width: 400px; margin: 8vh auto 0; padding: 0 1rem; }

/* Étiquette */
@media print {
  .topbar, .nav, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  main { padding: 0; }
}
.label-sheet { border: 2px dashed var(--navy); border-radius: 12px; padding: 1.2rem; max-width: 420px; background: #fff; }
.label-sheet .code-box { font-size: 2rem; }
