* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Avenir, Montserrat, Corbel, URW Gothic, system-ui, sans-serif;
  background: #f4f4f0;
  color: #111;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

body.dark-mode {
  background: #111;
  color: #f0f0f0;
}

a { color: inherit; }

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 5rem;
  padding: 0 1rem 0 1.5rem;
  background: #f4f4f0;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

body.dark-mode .header {
  background: #111;
  border-color: rgba(255, 255, 255, 0.08);
}

.brand {
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: underline;
}

.brand-pink {
  color: #fe8ce3;
}

.header-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}

.nav-link:hover {
  opacity: 0.75;
}

.btn-toggle {
  border: none;
  background: transparent;
  padding: 0.5rem;
  cursor: pointer;
  color: inherit;
}

.btn-toggle svg {
  width: 1.35rem;
  height: 1.35rem;
}

.cta-bar {
  background: linear-gradient(90deg, #fe8ce3 0%, #f06dd5 25%, #ff9beb 55%, #f06dd5 75%, #fe8ce3 100%);
  background-size: 300% 100%;
  color: #000;
  text-align: center;
  padding: 1rem 1.25rem;
  font-weight: 700;
  animation: fb-shimmer 6s linear infinite;
}

.cta-bar a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.35rem;
  padding: 0.35rem 1rem;
  background: #000;
  color: #fff;
  border-radius: 999px;
  font-size: 0.9rem;
  text-decoration: none;
}

.cta-bar a:hover {
  opacity: 0.9;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.sub {
  color: rgba(0, 0, 0, 0.55);
  margin-bottom: 2rem;
}

body.dark-mode .sub {
  color: rgba(255, 255, 255, 0.55);
}

.card {
  background: #fff;
  border: 2px solid #000;
  border-radius: 1.25rem;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 5px 5px 0 #000;
  transition: transform 0.22s cubic-bezier(.4,0,.2,1), box-shadow 0.22s cubic-bezier(.4,0,.2,1);
}

body.dark-mode .card {
  background: #1a1a1a;
  border-color: #444;
  box-shadow: 5px 5px 0 #333;
}

.card h2 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.row > * {
  flex: 1;
  min-width: 140px;
}

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 2px solid #000;
  border-radius: 0.5rem;
  font: inherit;
  background: #fff;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  background: #111;
  border-color: #555;
  color: #f0f0f0;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  border: 2px solid #000;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: #fe8ce3;
  color: #000;
  transition: transform 0.15s cubic-bezier(.4,0,.2,1), filter 0.15s, box-shadow 0.15s;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(254, 140, 227, 0.45);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

.btn.secondary {
  background: #fff;
}

body.dark-mode .btn.secondary {
  background: #222;
  color: #f0f0f0;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.msg {
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.msg.err {
  background: #ffe0e0;
  border: 1px solid #c00;
  color: #600;
}

.msg.ok {
  background: #dcfce7;
  border: 1px solid #166534;
  color: #14532d;
}

body.dark-mode .msg.err {
  background: #3f1d1d;
  border-color: #f87171;
  color: #fecaca;
}

body.dark-mode .msg.ok {
  background: #14532d;
  border-color: #22c55e;
  color: #dcfce7;
}

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: rgba(254, 140, 227, 0.15);
  font-weight: 700;
  margin-bottom: 1rem;
}

.steps {
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.45);
  margin-top: -1rem;
  margin-bottom: 1.5rem;
}

body.dark-mode .steps {
  color: rgba(255, 255, 255, 0.4);
}

.hidden {
  display: none !important;
}

.order-list {
  font-size: 0.9rem;
}

.order-list li {
  margin-bottom: 0.5rem;
  padding: 0.3rem 0.5rem 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.35rem;
  transition: background 0.15s;
}

.order-list li:hover {
  background: rgba(254, 140, 227, 0.07);
}

body.dark-mode .order-list li {
  border-color: rgba(255, 255, 255, 0.08);
}

.pdd-badge {
  display: inline-block;
  font-size: 0.78rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
  margin-top: 0.3rem;
}
.pdd-ok      { background: rgba(34, 197, 94, 0.15); color: #16a34a; }
.pdd-pending { background: rgba(234, 179, 8, 0.15);  color: #a16207; }
body.dark-mode .pdd-ok      { color: #4ade80; }
body.dark-mode .pdd-pending { color: #facc15; }

.btn-pdd {
  font-size: 0.78rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(254, 140, 227, 0.5);
  background: transparent;
  color: inherit;
  cursor: pointer;
  margin-top: 0.3rem;
  transition: background 0.15s;
}
.btn-pdd:hover { background: rgba(254, 140, 227, 0.12); }

.btn-pdd-dl {
  font-size: 0.78rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.45);
  color: #6366f1;
  text-decoration: none;
  margin-left: 0.4rem;
  transition: background 0.15s;
}
.btn-pdd-dl:hover { background: rgba(99, 102, 241, 0.1); }
body.dark-mode .btn-pdd-dl { color: #a5b4fc; border-color: rgba(165, 180, 252, 0.4); }

.pdd-note {
  font-size: 0.82rem;
  margin-top: 0.35rem;
  padding: 0.3rem 0.6rem;
  border-left: 2px solid rgba(254, 140, 227, 0.5);
  color: inherit;
  opacity: 0.85;
  white-space: pre-wrap;
  word-break: break-word;
}

.order-row-top { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.2rem; }
.order-row-mid { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; margin-bottom: 0.2rem; font-size: 0.82rem; opacity: 0.85; }
.order-row-bot { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; }
.order-date    { font-size: 0.75rem; opacity: 0.55; }

/* ── Onglets app ─────────────────────────────────────── */
.app-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  background: rgba(0,0,0,0.04);
  border-radius: 0.75rem;
  padding: 0.3rem;
}
body.dark-mode .app-tabs { background: rgba(255,255,255,0.05); }

.app-tab {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border-radius: 0.55rem;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: inherit;
  opacity: 0.55;
  transition: background 0.18s, opacity 0.18s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.app-tab:hover { opacity: 0.8; background: rgba(254,140,227,0.08); }
.app-tab.active {
  background: #fff;
  opacity: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
body.dark-mode .app-tab.active {
  background: #2a2a2a;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #fe8ce3;
  color: #000;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
}

/* ── Filtres / tri ─────────────────────────────────── */
.order-filters {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.filter-top-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}

.filter-search {
  flex: 2 1 140px;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid rgba(0,0,0,0.14);
  border-radius: 0.5rem;
  font: inherit;
  font-size: 0.88rem;
  background: transparent;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.filter-search:focus {
  outline: none;
  border-color: #fe8ce3;
  box-shadow: 0 0 0 3px rgba(254,140,227,0.18);
}
body.dark-mode .filter-search { border-color: rgba(255,255,255,0.16); }

.filter-carrier-sel,
.filter-sort-select {
  flex: 1 1 120px;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border: 1.5px solid rgba(0,0,0,0.14);
  border-radius: 0.5rem;
  font: inherit;
  font-size: 0.82rem;
  background: transparent;
  color: inherit;
}
body.dark-mode .filter-carrier-sel,
body.dark-mode .filter-sort-select { border-color: rgba(255,255,255,0.16); background: #111; }

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.chip {
  padding: 0.28rem 0.75rem;
  border: 1.5px solid rgba(0,0,0,0.18);
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  color: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover { background: rgba(254,140,227,0.1); }
.chip.active { background: #fe8ce3; border-color: #fe8ce3; color: #000; }
body.dark-mode .chip { border-color: rgba(255,255,255,0.2); }

/* ── Groupes transporteur dans la liste ───────────── */
.order-carrier-group-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.5rem 0.2rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.55;
  border-bottom: none;
  margin-top: 0.75rem;
  background: transparent !important;
}
.order-carrier-group-hdr:first-child { margin-top: 0; }
.order-carrier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3rem;
  height: 1.3rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: rgba(0,0,0,0.08);
  font-size: 0.68rem;
  font-weight: 800;
}
body.dark-mode .order-carrier-badge { background: rgba(255,255,255,0.1); }

.order-carrier-tag {
  display: inline-block;
  font-size: 0.73rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: rgba(254,140,227,0.12);
  font-weight: 600;
}

/* ── Statut coloré ────────────────────────────────── */
.order-status-badge { font-size: 0.72rem; padding: 0.1rem 0.5rem; border-radius: 999px; font-weight: 600; }
.status-en_cours   { background: rgba(234,179,8,0.12);  color: #a16207; }
.status-traitement { background: rgba(99,102,241,0.12); color: #4338ca; }
.status-dropper    { background: rgba(34,197,94,0.12);  color: #16a34a; }
.status-terminee   { background: rgba(34,197,94,0.18);  color: #14532d; }
.status-annulee    { background: rgba(239,68,68,0.1);   color: #b91c1c; }
body.dark-mode .status-en_cours   { color: #fbbf24; }
body.dark-mode .status-traitement { color: #818cf8; }
body.dark-mode .status-dropper    { color: #4ade80; }
body.dark-mode .status-terminee   { color: #86efac; }
body.dark-mode .status-annulee    { color: #fca5a5; }

.order-empty { opacity: .55; padding: .5rem; list-style: none; }

/* ── Bouton relance ── */
.btn-relance {
  font-size: 0.78rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(234,179,8,0.55);
  background: transparent;
  color: #a16207;
  cursor: pointer;
  margin-top: 0.3rem;
  transition: background 0.15s, opacity 0.15s;
  font-weight: 600;
}
.btn-relance:hover:not(:disabled) { background: rgba(234,179,8,0.12); }
.btn-relance:disabled { opacity: 0.45; cursor: not-allowed; }
body.dark-mode .btn-relance { color: #facc15; border-color: rgba(250,204,21,0.4); }

/* ─────────────────────────────────────────
   ANIMATIONS & MICRO-INTERACTIONS
   ───────────────────────────────────────── */

@keyframes fb-fadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fb-slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fb-shimmer {
  0%   { background-position: 100% center; }
  100% { background-position: -200% center; }
}

@keyframes fb-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(254, 140, 227, 0.55); }
  50%       { box-shadow: 0 0 0 9px rgba(254, 140, 227, 0); }
}

@keyframes fb-msgIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Header entrance */
.header {
  animation: fb-slideDown 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* CTA bar entrance */
.cta-bar {
  animation: fb-shimmer 6s linear infinite, fb-fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Page text staggered entrance */
h1     { animation: fb-fadeUp 0.55s 0.05s cubic-bezier(0.16, 1, 0.3, 1) both; }
.sub   { animation: fb-fadeUp 0.55s 0.10s cubic-bezier(0.16, 1, 0.3, 1) both; }
.steps { animation: fb-fadeUp 0.55s 0.14s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* Auth section entrance */
#authSection {
  animation: fb-fadeUp 0.55s 0.18s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* App section children staggered (fires when .hidden is removed) */
#appSection:not(.hidden) > :nth-child(1) {
  animation: fb-fadeUp 0.5s 0.00s cubic-bezier(0.16, 1, 0.3, 1) both;
}
#appSection:not(.hidden) > :nth-child(3) {
  animation: fb-fadeUp 0.5s 0.08s cubic-bezier(0.16, 1, 0.3, 1) both;
}
#appSection:not(.hidden) > :nth-child(4) {
  animation: fb-fadeUp 0.5s 0.16s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Card hover lift */
.card:hover {
  transform: translateY(-3px);
  box-shadow: 8px 8px 0 #000;
}
body.dark-mode .card:hover {
  box-shadow: 8px 8px 0 #3a3a3a;
}

/* Input / select / textarea focus glow */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #fe8ce3;
  box-shadow: 0 0 0 3px rgba(254, 140, 227, 0.22);
  transition: border-color 0.2s, box-shadow 0.2s;
}
body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
  border-color: #fe8ce3;
  box-shadow: 0 0 0 3px rgba(254, 140, 227, 0.16);
}

/* Balance glow pulse */
.balance-pill {
  animation: fb-glow 2.8s ease-in-out infinite;
}

/* Message slide-in (fires when .hidden class is removed) */
.msg:not(.hidden) {
  animation: fb-msgIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Nav links smooth */
.nav-link {
  transition: opacity 0.15s, color 0.15s;
}

/* Order list staggered entrance (new li elements) */
.order-list li:nth-child(1) { animation: fb-fadeUp 0.4s 0.00s cubic-bezier(0.16, 1, 0.3, 1) both; }
.order-list li:nth-child(2) { animation: fb-fadeUp 0.4s 0.05s cubic-bezier(0.16, 1, 0.3, 1) both; }
.order-list li:nth-child(3) { animation: fb-fadeUp 0.4s 0.10s cubic-bezier(0.16, 1, 0.3, 1) both; }
.order-list li:nth-child(4) { animation: fb-fadeUp 0.4s 0.15s cubic-bezier(0.16, 1, 0.3, 1) both; }
.order-list li:nth-child(5) { animation: fb-fadeUp 0.4s 0.19s cubic-bezier(0.16, 1, 0.3, 1) both; }
.order-list li:nth-child(6) { animation: fb-fadeUp 0.4s 0.23s cubic-bezier(0.16, 1, 0.3, 1) both; }
.order-list li:nth-child(7) { animation: fb-fadeUp 0.4s 0.26s cubic-bezier(0.16, 1, 0.3, 1) both; }
.order-list li:nth-child(8) { animation: fb-fadeUp 0.4s 0.29s cubic-bezier(0.16, 1, 0.3, 1) both; }

