/* HN Delivery — customer tracking + staff scan. HealthNeeds coral/cream. */

:root {
	--coral: #E4573D;
	--coral-dark: #C8452E;
	--ink: #2B2118;
	--cream: #FFFDF9;
	--sand: #FBF5EC;
	--border: #F0E7D6;
	--muted: #8A8172;
	--good: #3F6B3C;
	--good-bg: #EFF6EE;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
	font-family: "DM Sans", "Hanken Grotesk", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	background: var(--sand);
	color: var(--ink);
	min-height: 100vh;
}

.app { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
	background: var(--coral);
	color: #fff;
	padding: max(14px, env(safe-area-inset-top)) 18px 14px;
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.topbar .brand { font-weight: 800; font-size: 19px; letter-spacing: .02em; text-decoration: none; color: #fff; }
.topbar .tag { font-size: 11px; font-weight: 700; letter-spacing: .1em; background: rgba(255,255,255,.18); padding: 5px 12px; border-radius: 999px; white-space: nowrap; }

.shell { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 18px 16px 40px; }

.card {
	background: var(--cream);
	border: 1px solid var(--border);
	border-radius: 18px;
	padding: 22px 20px;
	box-shadow: 0 2px 14px rgba(43,33,24,.06);
	margin-bottom: 14px;
}
.card--center { text-align: center; padding: 44px 20px; }

.h1 { font-size: 22px; font-weight: 800; line-height: 1.25; margin-bottom: 6px; }
.sub { color: var(--muted); font-size: 14px; line-height: 1.5; }
.order-chip {
	display: inline-block; background: #fff; border: 1px solid var(--border);
	border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 13px; margin-bottom: 12px;
}

/* status headline */
.status-icon { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 2px auto 14px; font-size: 32px; background: #FDEEE9; }
.status-icon--delivered { background: var(--good-bg); }
.status-icon--moving { animation: hndFloat 2.6s ease-in-out infinite; }
@keyframes hndFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .status-icon--moving { animation: none; } }

/* ETA card */
.eta {
	display: flex; gap: 14px; align-items: center;
	background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px;
}
.eta-clock { font-size: 26px; }
.eta b { display: block; font-size: 15px; }
.eta span { color: var(--muted); font-size: 13px; }

.notice {
	border-radius: 14px; padding: 13px 16px; font-size: 14px; line-height: 1.5; margin-bottom: 14px;
	background: #FDF3E4; border: 1px solid #F0DEBB; color: #7A5A18;
}
.notice--fail { background: #FDEEE9; border-color: #F3C9BC; color: #8A2F1B; }

/* timeline */
.timeline { list-style: none; margin-top: 6px; }
.timeline li { position: relative; padding: 0 0 26px 42px; }
.timeline li:last-child { padding-bottom: 4px; }
.timeline li::before {
	content: ""; position: absolute; left: 13px; top: 26px; bottom: 0; width: 2px; background: var(--border);
}
.timeline li:last-child::before { display: none; }
.tl-dot {
	position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
	border: 2px solid var(--border); background: #fff; display: flex; align-items: center; justify-content: center;
	font-size: 13px; color: #fff; font-weight: 800;
}
li.done .tl-dot { background: var(--coral); border-color: var(--coral); }
li.done::before { background: var(--coral); }
li.current .tl-dot { box-shadow: 0 0 0 5px rgba(228,87,61,.16); }
.tl-label { font-weight: 700; font-size: 15px; padding-top: 3px; }
li.pending .tl-label { color: var(--muted); font-weight: 600; }
.tl-time { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tl-desc { color: var(--muted); font-size: 13px; margin-top: 2px; line-height: 1.45; }

/* buttons + forms */
.btn {
	display: block; width: 100%; min-height: 54px; border: 0; border-radius: 14px;
	background: var(--coral); color: #fff; font-size: 17px; font-weight: 800; cursor: pointer;
	font-family: inherit; transition: background .12s; text-align: center; text-decoration: none;
	line-height: 54px;
}
.btn:active, .btn:hover { background: var(--coral-dark); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn--ghost { background: #fff; color: var(--ink); border: 2px solid var(--border); line-height: 50px; }
.btn--ghost:hover, .btn--ghost:active { background: var(--sand); }
.btn + .btn { margin-top: 10px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.field input, .field select {
	width: 100%; min-height: 52px; padding: 8px 14px; font-size: 16px; font-family: inherit;
	border: 2px solid var(--border); border-radius: 12px; background: #fff; color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--coral); }
.form-error { color: #a02912; font-size: 14px; font-weight: 600; margin: 4px 0 10px; min-height: 20px; }

.staff-badge { display: inline-block; background: var(--good-bg); color: var(--good); border-radius: 999px; font-size: 12px; font-weight: 700; padding: 4px 12px; margin-bottom: 10px; }
.summary-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 14.5px; }
.summary-row:last-child { border-bottom: 0; }
.summary-row b { font-weight: 700; }
.summary-row span { color: var(--muted); }

.result-tick { font-size: 54px; margin-bottom: 8px; }

.stop { border: 1px solid var(--border); background: #fff; border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; }
.stop-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.stop-num { font-weight: 800; }
.stop-stage { font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 3px 10px; background: #FDEEE9; color: #B4462E; }
.stop-addr { font-size: 14px; color: var(--ink); margin: 4px 0 10px; line-height: 1.45; }
.stop-actions { display: flex; gap: 8px; }
.stop-actions a { flex: 1; min-height: 44px; line-height: 44px; text-align: center; border-radius: 10px; text-decoration: none; font-weight: 700; font-size: 14px; }
.stop-actions .call { background: var(--good-bg); color: var(--good); }
.stop-actions .nav { background: #F4F1FB; color: #4C4470; }

.foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.foot a { color: var(--muted); }

/* live map card */
.card--live { padding: 16px 16px 14px; }
.live-head { font-size: 15.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.card--live > span { display: block; color: var(--muted); font-size: 13px; margin: 2px 0 10px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #2FA24F; box-shadow: 0 0 0 4px rgba(47,162,79,.18); animation: hndPulse 1.6s ease-in-out infinite; flex: 0 0 auto; }
@keyframes hndPulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
#hnd-map { height: 300px; border-radius: 12px; background: #EDE7DB; }
.hnd-marker-driver, .hnd-marker-home { font-size: 24px; line-height: 1; text-align: center; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }

/* driver: location chip */
.ping-chip { display: inline-block; margin-top: 10px; font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 6px 13px; background: #EEE9DE; color: var(--muted); }
.ping-chip--on { background: var(--good-bg); color: var(--good); }
.ping-chip--err { background: #FDEEE9; color: #8A2F1B; }
.stop-stage--active { background: var(--good-bg); color: var(--good); }

/* POD */
.pod-box { border-top: 1px dashed var(--border); margin-top: 14px; padding-top: 14px; }
#hnd-pod-preview { display: block; max-width: 100%; max-height: 220px; border-radius: 12px; margin: 10px auto; border: 1px solid var(--border); }
.pod-hint { text-align: center; margin-top: 8px; }

/* scanner overlay */
#hnd-scanner { position: fixed; inset: 0; z-index: 1000; background: #000; display: flex; align-items: center; justify-content: center; }
#hnd-scan-video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; width: min(68vw, 340px); aspect-ratio: 1; border: 3px solid rgba(255,255,255,.9); border-radius: 22px; box-shadow: 0 0 0 200vmax rgba(0,0,0,.45); pointer-events: none; }
.scan-hint { position: absolute; bottom: 108px; color: #fff; font-weight: 600; font-size: 14px; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.scan-close { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); width: min(70vw, 260px); }

.spinner {
	width: 34px; height: 34px; margin: 0 auto; border-radius: 50%;
	border: 4px solid var(--border); border-top-color: var(--coral);
	animation: hndSpin .8s linear infinite;
}
@keyframes hndSpin { to { transform: rotate(360deg); } }

@media (min-width: 700px) {
	.shell { padding-top: 34px; }
	.h1 { font-size: 25px; }
}
