/* ═══════════ Mini CRM Livreurs — mobile first, dark glass ═══════════ */
:root {
  --bg: #0b1020;
  --bg2: #111833;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-b: rgba(255, 255, 255, 0.12);
  --text: #eef1ff;
  --muted: #9aa3c7;
  --primary: #7c5cff;
  --primary2: #22d3ee;
  --green: #34d399;
  --red: #fb7185;
  --amber: #fbbf24;
  --radius: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Outfit", system-ui, -apple-system, sans-serif;
  background: radial-gradient(120% 80% at 50% 0%, #1a2150 0%, var(--bg) 60%) fixed;
  color: var(--text);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.4;
  overflow-x: hidden;
}
h1, h2 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 1.7rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.c-green { color: var(--green); }
.c-red { color: var(--red); }

/* Fond animé */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-orbs span {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.35;
  animation: float 18s ease-in-out infinite alternate;
}
.bg-orbs span:nth-child(1) { width: 320px; height: 320px; background: var(--primary); top: -80px; left: -100px; }
.bg-orbs span:nth-child(2) { width: 260px; height: 260px; background: var(--primary2); bottom: 10%; right: -90px; animation-delay: -6s; }
.bg-orbs span:nth-child(3) { width: 200px; height: 200px; background: #f472b6; top: 40%; left: 30%; opacity: 0.15; animation-delay: -12s; }
@keyframes float { to { transform: translate(40px, 60px) scale(1.15); } }

.container { max-width: 520px; margin: 0 auto; padding: 1rem 1rem calc(6.5rem + var(--safe-b)); }

/* Glass */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}
.card { border-radius: var(--radius); padding: 1.2rem; margin-bottom: 1rem; animation: rise 0.45s ease both; }
.card-title { margin-bottom: 0.9rem; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(0.7rem + env(safe-area-inset-top, 0px)) 1rem 0.7rem;
  background: rgba(11, 16, 32, 0.7);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-b);
}
.topbar-id { display: flex; gap: 0.7rem; align-items: center; }
.avatar {
  width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center;
  font-weight: 800; background: linear-gradient(135deg, var(--primary), var(--primary2));
}
.topbar-name { font-weight: 700; }
.topbar-sub { font-size: 0.75rem; color: var(--muted); }
.topbar form { margin: 0; }

.icon-btn {
  border: 1px solid var(--glass-b); background: var(--glass); color: var(--text);
  width: 42px; height: 42px; border-radius: 14px; font-size: 1.1rem; cursor: pointer;
  display: inline-grid; place-items: center; transition: transform 0.15s, background 0.2s;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn.danger { border-color: rgba(251, 113, 133, 0.4); }

/* Tab bar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-around;
  padding: 0.5rem 0.5rem calc(0.5rem + var(--safe-b));
  background: rgba(11, 16, 32, 0.85);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--glass-b);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 0.4rem; border-radius: 14px; font-size: 0.78rem; color: var(--muted); transition: all 0.2s;
}
.tab-ico { font-size: 1.35rem; transition: transform 0.2s; }
.tab.active { color: var(--text); background: rgba(124, 92, 255, 0.18); }
.tab.active .tab-ico { transform: translateY(-2px) scale(1.1); }

/* Toasts */
.toast {
  border-radius: 14px; padding: 0.85rem 1rem; margin-bottom: 0.8rem; font-weight: 500;
  border: 1px solid; animation: rise 0.35s ease both;
}
.toast-success { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.4); }
.toast-danger { background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.45); }
.toast-warning { background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.4); }
.toast-info { background: rgba(34, 211, 238, 0.1); border-color: rgba(34, 211, 238, 0.35); }
.toast.hide { opacity: 0; transform: translateY(-8px); transition: all 0.4s; }

/* Buttons */
.btn {
  display: inline-flex; justify-content: center; align-items: center; gap: 0.4rem;
  border: 0; border-radius: 16px; padding: 1rem 1.2rem; font: inherit; font-weight: 700;
  font-size: 1.05rem; cursor: pointer; color: var(--text); transition: transform 0.15s, filter 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; }
.btn-block { width: 100%; margin-top: 0.6rem; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #5b8cff 55%, var(--primary2));
  box-shadow: 0 8px 26px rgba(124, 92, 255, 0.4);
}
.btn-ghost { background: var(--glass); border: 1px solid var(--glass-b); }

/* Forms */
.form { display: flex; flex-direction: column; gap: 0.2rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.8rem; }
.field-label { font-size: 0.9rem; color: var(--muted); }
.field input, .pwd-wrap input {
  width: 100%; font: inherit; font-size: 1.05rem; color: var(--text);
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--glass-b);
  border-radius: 14px; padding: 0.9rem 1rem; outline: none; transition: border 0.2s, box-shadow 0.2s;
}
.field input:focus, .pwd-wrap input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.2); }
.pwd-wrap { position: relative; display: block; }
.pwd-wrap input { padding-right: 3rem; }
.eye { position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%); background: none; border: 0; font-size: 1.1rem; cursor: pointer; opacity: 0.7; }
.captcha { color: var(--primary2); font-size: 1.05rem; }

/* Login */
.login-wrap { min-height: 92vh; display: flex; flex-direction: column; justify-content: center; padding-top: 1rem; }
.brand { text-align: center; margin-bottom: 1.4rem; animation: rise 0.5s ease both; }
.brand-logo {
  width: 78px; height: 78px; margin: 0 auto 0.8rem; border-radius: 24px; font-size: 2.4rem;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  box-shadow: 0 12px 40px rgba(124, 92, 255, 0.5);
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.05); box-shadow: 0 16px 50px rgba(34, 211, 238, 0.45); } }
.big-ico { font-size: 2.6rem; margin-bottom: 0.5rem; }
.foot { text-align: center; font-size: 0.78rem; margin-top: 1rem; }

/* Page head */
.page-head { margin: 0.6rem 0 1rem; }
.page-head p { margin: 0.2rem 0 0; }

/* Stepper */
.stepper {
  display: flex; justify-content: space-between; align-items: center; gap: 0.6rem;
  padding: 0.75rem 0.8rem; border-radius: 16px; margin-bottom: 0.6rem;
  background: rgba(0, 0, 0, 0.2); border: 1px solid var(--glass-b); border-left: 4px solid var(--c, var(--primary));
}
.f-cadeau { --c: #f472b6; }
.f-50 { --c: #60a5fa; }
.f-55 { --c: #a78bfa; }
.f-60 { --c: #34d399; }
.f-tz { --c: #fbbf24; }
.stepper-label { font-weight: 600; display: flex; align-items: center; gap: 0.5rem; font-size: 0.98rem; }
.stepper-ico { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.07); font-size: 0.95rem; }
.stepper-ctrl { display: flex; align-items: center; gap: 0.4rem; }
.step-btn {
  width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--glass-b);
  background: var(--glass); color: var(--text); font-size: 1.5rem; font-weight: 600; cursor: pointer;
  transition: transform 0.12s, background 0.2s;
}
.step-btn.plus { background: color-mix(in srgb, var(--c) 30%, transparent); border-color: color-mix(in srgb, var(--c) 60%, transparent); }
.step-btn:active { transform: scale(0.88); }
.step-input { position: relative; }
.step-input input {
  width: 78px; text-align: center; font: inherit; font-size: 1.3rem; font-weight: 800; color: var(--text);
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--glass-b); border-radius: 12px; padding: 0.55rem 1.1rem 0.55rem 0.3rem; outline: none;
}
.step-input input:focus { border-color: var(--c); }
.step-input .unit { position: absolute; right: 0.45rem; top: 50%; transform: translateY(-50%); font-size: 0.75rem; color: var(--muted); }
.step-input input.bump { animation: bump 0.25s ease; }
@keyframes bump { 50% { transform: scale(1.12); } }

.live-est { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin: 0.4rem 0 0.2rem; }
.live-est > div { display: flex; flex-direction: column; padding: 0.7rem 0.9rem; border-radius: 14px; background: rgba(255, 255, 255, 0.04); }
.live-est strong { font-size: 1.15rem; }

/* Sheet (confirmation) */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-panel { width: 100%; max-width: 520px; border-radius: 24px 24px 0 0; padding: 1.4rem 1.2rem calc(1.4rem + var(--safe-b)); animation: slideup 0.3s ease both; background: rgba(17, 24, 51, 0.96); }
@keyframes slideup { from { transform: translateY(100%); } }
.recap { list-style: none; padding: 0; margin: 1rem 0; }
.recap li { display: flex; justify-content: space-between; padding: 0.65rem 0; border-bottom: 1px dashed var(--glass-b); font-size: 1.05rem; }
.recap li b { font-size: 1.15rem; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 0.6rem; margin-top: 0.8rem; }

/* Sections & entries */
.section { margin-top: 1.4rem; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.7rem; }
.pill { font-size: 0.78rem; padding: 0.25rem 0.65rem; border-radius: 99px; background: var(--glass); border: 1px solid var(--glass-b); color: var(--muted); }
.totals-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; margin-bottom: 0.8rem; }
.totals-strip > div { text-align: center; padding: 0.55rem 0.2rem; border-radius: 12px; background: var(--glass); border: 1px solid var(--glass-b); }
.totals-strip small { display: block; color: var(--muted); font-size: 0.72rem; }
.totals-strip b { font-size: 1.05rem; }
.entries { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.entry { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; padding: 0.8rem; border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-b); animation: rise 0.35s ease both; }
.entry.locked { opacity: 0.75; }
.entry-time { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.3rem; }
.entry-vals { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.entry-actions { display: flex; gap: 0.4rem; align-items: center; }
.entry-actions form { margin: 0; }
.chip { font-size: 0.8rem; padding: 0.22rem 0.55rem; border-radius: 99px; background: rgba(124, 92, 255, 0.18); }
.chip-cadeau { background: rgba(244, 114, 182, 0.18); }
.chip-tz { background: rgba(251, 191, 36, 0.18); }
.badge-lock { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.empty { text-align: center; padding: 1.4rem; color: var(--muted); border: 1px dashed var(--glass-b); border-radius: 16px; }
.link-card { display: flex; justify-content: space-between; align-items: center; }
.big { font-size: 1.6rem; font-weight: 800; }
.arrow { font-size: 2rem; color: var(--muted); }

/* Compte */
.hero-card { border-radius: 24px; padding: 1.3rem; margin-bottom: 1rem; position: relative; overflow: hidden; animation: rise 0.45s ease both; }
.hero-card::after { content: ""; position: absolute; inset: auto -40px -60px auto; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(var(--primary), transparent 70%); opacity: 0.35; }
.hero-card.commission::after { background: radial-gradient(var(--green), transparent 70%); }
.hero-label { color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.hero-amount { font-size: 2.6rem; font-weight: 800; letter-spacing: -0.03em; margin: 0.3rem 0; }
.hero-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-top: 0.5rem; }
.hero-row.hero-row-3 { grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)); }
.hero-row.hero-row-3 > div { min-width: 0; padding: 0.6rem 0.65rem; }
.hero-row.hero-row-3 b { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-row > div, .detail-grid > div { display: flex; flex-direction: column; padding: 0.65rem 0.8rem; border-radius: 14px; background: rgba(0, 0, 0, 0.2); }
.hero-row small, .detail-grid small { color: var(--muted); font-size: 0.78rem; }
.hint { font-size: 0.85rem; color: var(--amber); margin: 0.6rem 0 0; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.detail-grid .span2 { grid-column: span 2; }
.divider { height: 1px; background: var(--glass-b); margin: 1rem 0; }
.badge-ok, .badge-wait, .badge-red { font-size: 0.72rem; padding: 0.2rem 0.55rem; border-radius: 99px; font-weight: 600; }
.badge-ok { background: rgba(52, 211, 153, 0.18); color: var(--green); }
.badge-wait { background: rgba(251, 191, 36, 0.18); color: var(--amber); }
.badge-red { background: rgba(251, 113, 133, 0.18); color: var(--red); }
.history { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.history-item { display: flex; justify-content: space-between; align-items: center; padding: 0.85rem 1rem; border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-b); }
.h-week { font-weight: 800; font-size: 1.1rem; }
.h-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
.h-amount { font-weight: 700; }
.sec-list { margin: 0; padding-left: 1.1rem; color: var(--muted); display: flex; flex-direction: column; gap: 0.4rem; }

/* Badge compact sachet ziploc / pack scellé TZ */
.tz-pouch-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.14);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: var(--cyan, #38bdf8);
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
}
.tz-pouch-pill.tz-pouch-sm {
  font-size: 0.74rem;
  padding: 0.08rem 0.35rem;
  gap: 0.2rem;
}
.tz-pouch-pill.tz-pouch-lg {
  font-size: 0.95rem;
  padding: 0.18rem 0.55rem;
}
.tz-pouch-icon {
  flex-shrink: 0;
  vertical-align: -1px;
}

/* Toile Matrix d'arrière-plan */
.matrix-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

/* Effets Matrix sur carte login livreur */
.card.card-success-glow {
  border-color: #00ff66 !important;
  box-shadow: 0 0 45px rgba(0, 255, 102, 0.45), 0 0 90px rgba(0, 255, 102, 0.2) !important;
}

.card.card-error-glitch {
  border-color: #ff0033 !important;
  box-shadow: 0 0 45px rgba(255, 0, 51, 0.55), 0 0 90px rgba(255, 0, 51, 0.25) !important;
}

@keyframes shakeMatrix {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-12px); }
  30% { transform: translateX(10px); }
  45% { transform: translateX(-8px); }
  60% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}
.shake-anim {
  animation: shakeMatrix 0.45s ease both;
}

/* Terminal de statut cyber */
.terminal-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.55rem 0.8rem;
  font-family: monospace;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  transition: all 0.3s ease;
}

.terminal-status .terminal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.terminal-status.status-idle {
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--muted);
}
.terminal-status.status-idle .terminal-dot {
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
}

.terminal-status.status-success {
  border-color: #00ff66 !important;
  background: rgba(0, 40, 15, 0.8) !important;
  color: #a7f3d0 !important;
  box-shadow: 0 0 15px rgba(0, 255, 102, 0.25) !important;
}
.terminal-status.status-success .terminal-dot {
  background: #00ff66 !important;
  box-shadow: 0 0 10px #00ff66 !important;
}

.terminal-status.status-error {
  border-color: #ff0033 !important;
  background: rgba(45, 5, 12, 0.85) !important;
  color: #fecdd3 !important;
  box-shadow: 0 0 15px rgba(255, 0, 51, 0.3) !important;
}
.terminal-status.status-error .terminal-dot {
  background: #ff0033 !important;
  box-shadow: 0 0 10px #ff0033 !important;
}

@media (min-width: 600px) {
  .container { padding-top: 1.5rem; }
}

