/* Core Link Logistics - live tracking pages (track.html, driver.html, track-admin.html). Uses variables from styles.css. */
.tk-body { min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); }
.tk-header { position: sticky; top: 0; z-index: 1000; background: var(--navy-deep); color: var(--white); }
.tk-header-inner { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tk-brand { display: flex; align-items: center; width: 150px; height: 44px; overflow: hidden; }
.tk-brand img { width: 150px; height: 96px; object-fit: contain; }
.tk-call { display: inline-flex; align-items: center; gap: 8px; color: var(--white); font-weight: 700; font-size: 0.95rem; text-decoration: none; }
.tk-call svg { width: 18px; height: 18px; fill: var(--orange); }
.tk-main { flex: 1; padding: 18px 0 40px; }
.tk-eyebrow { margin: 0 0 6px; color: var(--orange); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.17em; text-transform: uppercase; }
.tk-title { margin: 0 0 4px; color: var(--navy); font-family: var(--font-display); font-size: clamp(1.7rem, 6vw, 2.4rem); font-weight: 600; line-height: 1.05; text-transform: uppercase; letter-spacing: -0.01em; }
.tk-sub { margin: 0; color: var(--muted); font-size: 0.92rem; }
.tk-card { margin-top: 14px; padding: 18px; background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--orange); box-shadow: 0 14px 34px rgba(16, 42, 67, 0.07); }
.tk-card h2 { margin: 0 0 12px; color: var(--navy); font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.tk-status { display: flex; align-items: center; gap: 12px; }
.tk-status-dot { flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%; background: #70c993; box-shadow: 0 0 0 5px rgba(112, 201, 147, 0.18); }
.tk-status-dot.is-idle { background: #b9c2c6; box-shadow: 0 0 0 5px rgba(185, 194, 198, 0.25); }
.tk-status-dot.is-done { background: var(--orange); box-shadow: 0 0 0 5px rgba(233, 120, 36, 0.18); }
.tk-status strong { display: block; color: var(--navy); font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; text-transform: uppercase; line-height: 1.1; }
.tk-status span { color: var(--muted); font-size: 0.88rem; }
.tk-eta { margin-top: 14px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; background: var(--cream); }
.tk-eta span { color: var(--ink); font-size: 0.85rem; font-weight: 600; }
.tk-eta strong { color: var(--navy); font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; }
.tk-map-wrap { position: relative; margin-top: 14px; border: 1px solid var(--line); background: #e8e4dc; }
.tk-map { height: 52vh; min-height: 300px; max-height: 560px; }
.tk-map-empty { position: absolute; inset: 0; z-index: 500; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--navy); font-weight: 600; background: rgba(244, 240, 232, 0.92); }
.tk-map-empty[hidden] { display: none; }
.tk-updated { margin: 8px 0 0; color: var(--muted); font-size: 0.85rem; }
.tk-warn { margin: 10px 0 0; padding: 10px 12px; border-left: 4px solid var(--orange); background: #fff4ea; color: var(--ink); font-size: 0.88rem; }
.tk-warn[hidden] { display: none; }
.tk-timeline { margin: 0; padding: 0; list-style: none; }
.tk-timeline li { position: relative; padding: 0 0 16px 30px; color: var(--muted); font-size: 0.93rem; }
.tk-timeline li::before { content: ""; position: absolute; left: 4px; top: 5px; width: 12px; height: 12px; border: 2px solid #b9c2c6; border-radius: 50%; background: var(--white); }
.tk-timeline li::after { content: ""; position: absolute; left: 10px; top: 21px; bottom: 0; width: 2px; background: #d9dfdf; }
.tk-timeline li:last-child { padding-bottom: 0; }
.tk-timeline li:last-child::after { display: none; }
.tk-timeline li.is-done { color: var(--navy); font-weight: 600; }
.tk-timeline li.is-done::before { border-color: var(--orange); background: var(--orange); }
.tk-timeline li.is-done::after { background: var(--orange); }
.tk-timeline li.is-current { color: var(--navy); font-weight: 700; }
.tk-timeline li.is-current::before { box-shadow: 0 0 0 5px rgba(233, 120, 36, 0.2); }
.tk-addr { margin: 0; display: grid; gap: 12px; }
.tk-addr div { display: grid; grid-template-columns: 92px 1fr; gap: 10px; font-size: 0.93rem; }
.tk-addr dt { color: var(--muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding-top: 2px; }
.tk-addr dd { margin: 0; color: var(--ink); }
.tk-help { margin-top: 14px; display: grid; gap: 10px; }
.tk-help .button { width: 100%; }
.tk-note { margin: 14px 0 0; color: var(--muted); font-size: 0.8rem; }
.tk-footer { padding: 18px 0 24px; background: var(--navy-deep); color: #aebfc9; font-size: 0.78rem; }
.tk-footer a { color: #dbe5eb; }
.tk-msg { margin: 18px 0 0; padding: 22px; background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--orange); }
.tk-msg h2 { margin: 0 0 8px; color: var(--navy); font-family: var(--font-display); text-transform: uppercase; }
.tk-msg[hidden], .tk-card[hidden], [data-tk-hidden] { display: none !important; }
.tk-layout { display: flex; flex-direction: column; }
.tk-side { display: contents; }
.tk-intro { order: 1; } .tk-status-card { order: 2; } .tk-mapcol { order: 3; } .tk-timeline-card { order: 4; } .tk-addr-card { order: 5; } .tk-help-wrap { order: 6; }

/* van marker */
.tk-van { width: 46px; height: 46px; display: grid; place-items: center; border: 3px solid var(--white); border-radius: 50%; background: var(--orange); box-shadow: 0 6px 18px rgba(9, 29, 47, 0.35); }
.tk-van svg { width: 28px; height: 28px; fill: var(--white); }
.leaflet-container { font-family: var(--font-body); }

/* driver page */
.dr-share { width: 100%; min-height: 76px; font-size: 1.25rem; font-family: var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; }
.dr-share.is-on { background: var(--navy); border-color: var(--navy); }
.dr-share.is-on:hover { background: var(--navy-deep); border-color: var(--navy-deep); }
.dr-live { margin: 12px 0 0; display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 0.92rem; font-weight: 600; }
.dr-stats { margin: 12px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dr-stats div { padding: 10px 12px; background: var(--cream); }
.dr-stats span { display: block; color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.dr-stats strong { color: var(--navy); font-size: 1rem; }
.dr-steps { display: grid; gap: 10px; }
.dr-steps .button { width: 100%; min-height: 58px; }
.dr-steps .button[disabled] { background: #d7dde0; border-color: #d7dde0; color: #66757f; cursor: not-allowed; transform: none; box-shadow: none; }
.dr-steps .button.button-light { border-color: var(--navy); color: var(--navy); }
.dr-keep { margin: 14px 0 0; padding: 12px 14px; background: var(--navy); color: var(--white); font-size: 0.9rem; font-weight: 600; }
.dr-err { margin: 10px 0 0; color: #b3261e; font-size: 0.88rem; font-weight: 700; min-height: 1.2em; }

/* admin page */
.ad-grid { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 24px; align-items: start; }
.ad-form label { display: block; margin: 12px 0 5px; color: var(--navy); font-size: 0.82rem; font-weight: 700; }
.ad-form label small { color: var(--muted); font-weight: 500; }
.ad-form input, .ad-form select, .ad-job select, .ad-job input { width: 100%; padding: 11px 12px; border: 1px solid #cfd6d7; border-radius: 0; background: var(--white); color: var(--ink); font: inherit; font-size: 0.93rem; }
.ad-form .button { width: 100%; margin-top: 18px; }
.ad-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ad-links { margin-top: 16px; padding: 16px; background: var(--cream); border: 1px dashed #cdbfa6; }
.ad-link { margin: 0 0 14px; }
.ad-link:last-child { margin-bottom: 0; }
.ad-link > span { display: block; margin-bottom: 5px; color: var(--navy); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.ad-link code { display: block; padding: 9px 10px; background: var(--white); border: 1px solid var(--line); font-size: 0.78rem; word-break: break-all; }
.ad-actions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.ad-actions .button { min-height: 38px; padding: 6px 12px; font-size: 0.82rem; gap: 6px; }
.ad-actions .button-light { border-color: var(--navy); color: var(--navy); }
.ad-jobs { display: grid; gap: 12px; }
.ad-job { padding: 14px; background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--orange); }
.ad-job header { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ad-job h3 { margin: 0; color: var(--navy); font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; }
.ad-job p { margin: 4px 0; font-size: 0.86rem; color: var(--ink); }
.ad-job .ad-meta { color: var(--muted); font-size: 0.78rem; }
.ad-job .ad-row { margin-top: 8px; align-items: end; }
.ad-job label { display: block; color: var(--navy); font-size: 0.75rem; font-weight: 700; margin-bottom: 4px; }
.ad-empty { color: var(--muted); font-size: 0.9rem; }
.ad-login { max-width: 420px; }
.ad-status-msg { min-height: 1.2em; margin: 10px 0 0; font-size: 0.86rem; font-weight: 700; color: #b3261e; }
.ad-status-msg.ok { color: #1f7a4a; }
.ad-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

@media (min-width: 900px) {
  .tk-main { padding: 34px 0 60px; }
  .tk-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 28px; align-items: start; }
  .tk-side { display: block; }
  .tk-mapcol { position: sticky; top: 84px; }
  .tk-mapcol .tk-map-wrap { margin-top: 0; }
  .tk-map { height: 620px; max-height: none; }
  .tk-narrow { max-width: 560px; margin-inline: auto; }
}
@media (max-width: 899px) { .ad-grid { grid-template-columns: 1fr; } }
.tk-body [hidden] { display: none !important; }
.tk-footer { padding: 18px 0 24px; } .tk-footer a, .tk-footer span { display: inline; margin: 0; font-size: inherit; }
/* Entry state (track.html with no ?t=): paste a tracking link or code */
.tk-entry[hidden] { display: none !important; }
.tk-entry { max-width: 560px; margin: 8px 0 0; }
@media (min-width: 900px) { .tk-entry { margin: 48px auto 24px; } }
.tk-entry .tk-sub { margin-bottom: 4px; }
.tk-entry-form label { display: block; margin: 0 0 6px; color: var(--navy); font-size: 0.85rem; font-weight: 700; }
.tk-entry-row { display: flex; gap: 8px; }
.tk-entry-row input { flex: 1; min-width: 0; padding: 12px 12px; border: 1px solid var(--line); border-radius: 2px; font: inherit; font-size: 1rem; color: var(--navy); background: var(--white); }
.tk-entry-row input:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
.tk-entry-row input[aria-invalid="true"] { border-color: #b42318; }
.tk-entry-row .button { flex: 0 0 auto; }
.tk-entry-help { margin: 10px 0 0; color: var(--muted); font-size: 0.85rem; }
.tk-entry-help a { color: var(--navy); font-weight: 700; }
.tk-entry-err { margin: 8px 0 0; color: #b42318; font-size: 0.85rem; font-weight: 600; }
