/* AllWays Delivering — Tracking Phase 1. Matches the main site brand. */
:root {
  --navy: #092c3a;
  --navy-2: #0f4051;
  --orange: #f05a28;
  --orange-dark: #c93e12;
  --paper: #f4f2ed;
  --surface: #ffffff;
  --ink: #14232b;
  --muted: #53656e;
  --line: #ccd4d6;
  --green: #1e7e34;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Public Sans", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
h1, h2, h3, .brand, .btn, .badge {
  font-family: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  letter-spacing: .02em;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 18px 16px 60px; }
.wrap.narrow { max-width: 520px; }

.topbar {
  background: var(--navy);
  color: #fff;
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.brand { font-size: 26px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.brand em { font-style: normal; font-weight: 600; color: var(--orange); font-size: 20px; }
.brand-mark {
  background: var(--orange); color: #fff; font-weight: 800;
  width: 40px; height: 40px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 20px;
}
.topbar-sub { font-size: 15px; opacity: .85; }
/* Persistent identity strip: the customer always sees whose page this is. */
.topbar-id { font-size: 14px; font-weight: 600; opacity: .95; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 6px 14px; white-space: nowrap; }
.topbar-id .code { letter-spacing: 1px; font-weight: 800; }
.topbar a { color: #fff; }
.topnav { display: flex; gap: 4px; align-items: center; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; min-width: 0; flex: 1 1 auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { text-decoration: none; font-weight: 700; font-size: 15px; padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
.topnav a:hover { background: rgba(255,255,255,.14); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px 0;
  box-shadow: 0 6px 18px rgba(20,35,43,.06);
}
.card h1 { margin: 0 0 10px; font-size: 34px; }
.card h2 { margin: 0 0 10px; font-size: 28px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

label { display: block; margin: 12px 0; font-weight: 600; font-size: 15px; }
input[type=text], input[type=password], input[type=number], input[type=email], select {
  width: 100%; padding: 13px 14px; font-size: 17px;
  border: 1.5px solid var(--line); border-radius: 12px; margin-top: 6px;
  background: #fbfcfe; color: var(--ink);
  -webkit-appearance: none; appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input[type=text]:focus, input[type=password]:focus, input[type=number]:focus, input[type=email]:focus, select:focus {
  outline: none; border-color: var(--orange); background: #fff;
  box-shadow: 0 0 0 3px rgba(240,90,40,.18);
}
select {
  padding-right: 42px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'><path d='M1 1l6 6 6-6' fill='none' stroke='%2353656e' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 16px center;
}
.btn {
  display: inline-block; border: 0; cursor: pointer;
  padding: 14px 22px; font-size: 22px; font-weight: 700;
  border-radius: 12px; text-decoration: none; text-align: center;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
}
.btn.primary { background: var(--orange); color: #fff; width: 100%; margin-top: 10px; box-shadow: 0 4px 14px rgba(240,90,40,.35); }
.btn.primary:active { background: var(--orange-dark); transform: translateY(1px); box-shadow: 0 2px 8px rgba(240,90,40,.3); }
.btn.ghost { background: transparent; color: var(--navy); border: 2px solid var(--line); }
.btn.small { font-size: 17px; padding: 9px 14px; width: auto; }
.btn.big-action { font-size: 30px; padding: 22px; width: 100%; margin-top: 14px; }

.badge {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  font-size: 20px; font-weight: 700; color: #fff; background: var(--muted);
}
.badge.label_created { background: #6c757d; }
.badge.received { background: var(--orange); }
.badge.loaded { background: var(--orange); }
.badge.delivered { background: var(--green); }
.badge.arrived { background: #2563eb; }

.alert {
  background: #fff3cd; border: 1px solid #e6c200; color: #664d03;
  padding: 12px 14px; border-radius: 10px;
}
.ok-msg {
  background: #d4edda; border: 1px solid #7fbf8f; color: #155724;
  padding: 14px; border-radius: 10px; font-size: 18px; font-weight: 600;
}

table.grid { width: 100%; border-collapse: collapse; font-size: 15px; }
table.grid th, table.grid td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
table.grid th { font-family: "Barlow Condensed", Arial, sans-serif; font-size: 18px; }

.timeline { list-style: none; margin: 14px 0 0; padding: 0; }
.timeline li {
  position: relative; padding: 0 0 18px 30px; border-left: 3px solid var(--line); margin-left: 8px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 4px; }
.timeline li::before {
  content: ""; position: absolute; left: -9px; top: 2px;
  width: 15px; height: 15px; border-radius: 50%; background: var(--line);
}
.timeline li.done::before { background: var(--green); }
.timeline li.now::before { background: var(--orange); box-shadow: 0 0 0 4px rgba(240,90,40,.25); }
.timeline li.todo .t-title { color: var(--muted); font-weight: 600; }
.timeline li.todo .t-meta { color: #9aa7ad; font-style: italic; }
.timeline .t-title { font-weight: 700; font-size: 18px; }
.timeline .t-meta { color: var(--muted); font-size: 14px; }

.tracking-num {
  font-family: "Barlow Condensed", Arial, sans-serif;
  font-size: 40px; font-weight: 800; letter-spacing: .04em;
}
.driver-link { display: inline-block; margin-top: 14px; font-size: 15px; color: var(--muted); }

.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat { flex: 1 1 140px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat .n { font-family: "Barlow Condensed", Arial, sans-serif; font-size: 44px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 14px; }

.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin: 0; flex: 1 1 160px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { height: 8px; }

/* ---------- shop spotlight (promo slot, kept quiet and separate) ---------- */
.card.spotlight {
  border-top: 3px solid var(--orange);
  background: #faf8f4;
}
.card.spotlight h2 { font-size: 24px; color: var(--navy); }
.card.spotlight p { margin: 6px 0; }

/* ---------- printable label sheet ---------- */
.sheet-actions { display: flex; gap: 10px; margin: 16px 0; flex-wrap: wrap; }
.label-sheet {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.label {
  border: 2px dashed #999; border-radius: 8px; background: #fff;
  padding: 10px; text-align: center; page-break-inside: avoid; min-width: 0;
}
.label img.qr { width: 100%; max-width: 110px; height: auto; }
.label .ln { font-family: "Barlow Condensed", Arial, sans-serif; font-size: 24px; font-weight: 800; margin: 4px 0 0; white-space: nowrap; }
@media (max-width: 520px) {
  .label { padding: 8px 6px; }
  .label .ln { font-size: 19px; }
  .label .tag { font-size: 10px; }
}
.label .ln { font-family: "Barlow Condensed", Arial, sans-serif; font-size: 24px; font-weight: 800; margin: 4px 0 0; }
.label .lnote { font-size: 13px; font-weight: 700; color: #111; margin-top: 2px; }
.label .lcode { font-size: 16px; font-weight: 800; color: #111; margin-top: 2px; letter-spacing: .5px; }
.label .tag { font-size: 11px; color: #555; }
@media print {
  .no-print, .topbar { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .label-sheet { gap: 6px; }
  .label { border: 1px solid #000; border-radius: 0; }
  .card { box-shadow: none; margin: 0; }
  .receipt-box { border: 2px solid #000; }
}

/* ---------- Receipt box (billing success) ---------- */
.receipt-box {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; margin: 14px auto; max-width: 420px; text-align: left;
  background: #fff;
}
.receipt-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.receipt-row:last-child { border-bottom: 0; }
.receipt-row span { color: var(--muted); }

/* ---------- Phase 2: tenant badge, powered-by line, exception statuses ---------- */
.code-badge {
  display: inline-block; font-size: 13px; font-weight: 700;
  background: #eef2ff; color: #3730a3; border-radius: 6px;
  padding: 4px 10px; margin: 6px 0; letter-spacing: .03em;
}
.code-badge b { letter-spacing: .06em; }
.powered { text-align: center; color: var(--muted); font-size: 14.5px; margin: 16px 0 6px; }
.powered b { color: var(--navy); }
.badge.attempted { background: #b45309; }
.badge.refused { background: #b91c1c; }
.badge.damaged { background: #b91c1c; }
.badge.cancelled { background: #6c757d; }

/* ---------- M4: shipment-history journey timeline + exceptions ---------- */
.hist-timeline { list-style: none; margin: 12px 0 0; padding: 0; }
.hist-timeline li {
  position: relative; padding: 0 0 16px 26px; border-left: 3px solid var(--line); margin-left: 8px;
}
.hist-timeline li:last-child { border-left-color: transparent; padding-bottom: 4px; }
.hist-timeline li::before {
  content: ""; position: absolute; left: -9px; top: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--green); border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--line);
}
.hist-timeline li.ht-exc::before { background: var(--orange); box-shadow: 0 0 0 2px var(--orange); }
.hist-timeline li.ht-exc-attempted { border-left-color: #b45309; background: #fff7ed;
  border-radius: 0 10px 10px 0; padding-top: 8px; padding-right: 10px; }
.hist-timeline li.ht-exc-refused, .hist-timeline li.ht-exc-damaged { border-left-color: #b91c1c;
  background: #fef2f2; border-radius: 0 10px 10px 0; padding-top: 8px; padding-right: 10px; }
.ht-status { font-weight: 800; font-size: 17px; }
.ht-meta { color: var(--muted); font-size: 13.5px; }
.ht-who { color: var(--muted); font-size: 14px; margin-top: 2px; }
.ht-note { font-size: 14.5px; margin-top: 4px; font-style: italic; }
.ht-gps { font-size: 13px; color: var(--muted); margin-top: 4px; }
.ht-gps::before { content: "\25CE"; margin-right: 5px; }
.ht-explain { font-size: 14.5px; margin-top: 6px; font-weight: 600; color: #7c2d12; }
.ht-exc-refused .ht-explain, .ht-exc-damaged .ht-explain { color: #7f1d1d; }

/* driver scan page: exception buttons */
.exc-buttons { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.exc-btn-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.exc-btn-row .btn { flex: 1 1 0; }

/* exception management queue */
.exc-queue {
  display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin: 10px 0; background: var(--surface);
}
.exc-queue > div { min-width: 0; }
.tracking-num.small { font-size: 19px; }
@media (max-width: 520px) {
  .exc-queue { flex-direction: column; }
  .exc-queue form { width: 100%; }
  .exc-queue .btn { width: 100%; }
}

/* M3 delivery proof (Batch A #4 + Batch B #11). */
.proof-block { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.proof-gps { font-weight: 700; color: var(--navy); }
.proof-photo { display: block; max-width: 100%; height: auto; border-radius: 10px;
  border: 1px solid var(--line); margin: 10px 0; }
.proof-sig { display: block; max-width: 300px; height: auto; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 6px; margin: 6px 0 12px; }
.sig-pad { display: block; width: 100%; max-width: 340px; height: 140px;
  background: #fff; border: 2px solid var(--line); border-radius: 10px;
  touch-action: none; margin: 8px 0; }

/* Customer route-timing box on the public tracking page. */
.eta-box { background: #eef4ff; border: 1px solid #c9d9f7; border-radius: 10px;
  padding: 10px 14px; margin: 12px 0; font-size: 15px; line-height: 1.5; }

/* Dispatch workflow stepper: numbered step trail + Back / Next buttons. */
.wf-steps { background:#fff; border:1px solid #e2e6ef; border-radius:12px; padding:10px 12px; margin:0 0 14px; }
.wf-steps ol { display:flex; gap:6px; list-style:none; margin:0 0 10px; padding:0; flex-wrap:wrap; }
.wf-steps li a, .wf-steps li span { display:inline-block; padding:6px 12px; border-radius:999px; text-decoration:none; font-size:13px; color:#3c4356; background:#f1f3f8; }
.wf-steps li.cur span { background:var(--navy,#1a56db); color:#fff; font-weight:700; }
.wf-steps li a:hover { background:#dfe6f5; }
.wf-nav { display:flex; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.wf-nav .btn { width:auto; margin-top:0; }

/* Horizontal-scroll arrows: appear only while a wide table has more content
   to swipe to. The JS wraps table.grid elements in .hscroll-wrap. */
.hscroll-wrap { position:relative; }
.hscroll { overflow-x:auto; -webkit-overflow-scrolling:touch; }
.hscroll-arrow { position:absolute; top:50%; transform:translateY(-50%); display:none; width:38px; height:38px; border-radius:50%; border:1px solid #c9d2e6; background:rgba(255,255,255,.95); color:#1a56db; font-size:20px; line-height:1; cursor:pointer; box-shadow:0 2px 8px rgba(20,30,60,.18); z-index:3; padding:0; }
.hscroll-l { left:6px; }
.hscroll-r { right:6px; }
.hscroll-wrap.can-l .hscroll-l { display:block; }
.hscroll-wrap.can-r .hscroll-r { display:block; }
.hscroll-arrow:hover { background:#1a56db; color:#fff; }

/* Show/Hide toggle inside the password box. */
.pw-wrap { position: relative; display: block; margin-top: 6px; }
.pw-wrap input[type=password], .pw-wrap input[type=text] { margin-top: 0; padding-right: 70px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--navy, #1a56db); font-size: 14px; font-weight: 700; cursor: pointer; padding: 8px 10px; }

/* Driver badge — inline on the customer's tracking page ("Your driver"). */
.driver-badge { display: flex; gap: 14px; align-items: flex-start; background: #f8fafc;
  border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px; margin: 14px 0; }
.db-photo { width: 76px; height: 76px; object-fit: cover; border-radius: 50%;
  border: 3px solid var(--navy, #1a56db); flex: 0 0 auto; }
/* Gray initial placeholder — shown on the badge when no photo or logo is uploaded. */
.db-initial { display: inline-flex; align-items: center; justify-content: center;
  width: 76px; height: 76px; border-radius: 50%; background: #cbd5e1; color: #475569;
  font-size: 32px; font-weight: 800; border: 3px solid #cbd5e1; flex: 0 0 auto; }
/* Small gray initial placeholder for the dispatch driver table. */
.drv-initial { display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: #cbd5e1; color: #475569; font-weight: 800;
  vertical-align: middle; flex: 0 0 auto; }
.db-info { min-width: 0; }
.db-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #64748b; font-weight: 700; }
.db-name { font-size: 20px; font-weight: 800; margin: 2px 0; }
.db-vehicle { color: #475569; font-size: 14px; margin-bottom: 6px; }
.db-bio { font-size: 14px; color: #334155; margin: 4px 0; }
.db-quote { font-size: 14px; font-style: italic; color: #64748b; margin: 4px 0 0; }
.db-phone { margin-top: 6px; font-size: 14px; }
