/* Keflod Drimas cargo tracking — navy #262161 and red #F70303, matching keflod.co.ke */
:root {
  --navy: #262161;
  --navy-2: #312b7a;
  --navy-deep: #191545;
  --red: #F70303;
  --red-text: #d10303;
  --red-on-navy: #ff6b6b;
  --bg: #f5f5fa;
  --surface: #ffffff;
  --ink: #18153d;
  --muted: #57557a;
  --line: #dcdbea;
  --soft: #eceaf7;
  --ok: #157347;
  --ok-soft: #e3f4ea;
  --hold: #9a5b00;
  --hold-soft: #fff1d6;
  --f-display: "Libre Franklin", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Source Sans 3", "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.0625rem/1.6 var(--f-body); -webkit-font-smoothing: antialiased; }
a { color: var(--navy); }
img, svg { max-width: 100%; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.15; margin: 0; text-wrap: balance; }
p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.narrow { max-width: 460px; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
svg { width: 1.1em; height: 1.1em; flex: none; }

/* header */
.topbar { background: var(--navy-deep); color: #bdbae0; font-size: .875rem; }
.topbar .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .25rem 1.5rem; padding-block: .4rem; }
.topbar a { color: #fff; text-decoration: none; }
header.site { background: var(--navy); color: #fff; border-bottom: 3px solid var(--red); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem 1.5rem; padding-block: .75rem; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: #fff; }
.brand .logo { width: 48px; height: 48px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--red); flex: none; }
.brand .logo img { width: 40px; height: 40px; }
.brand b { display: block; font: 800 1.05rem/1 var(--f-display); letter-spacing: .04em; }
.brand small { display: block; margin-top: .3rem; font: 600 .7rem/1 var(--f-body); letter-spacing: .2em; color: var(--red-on-navy); }
header nav { display: flex; flex-wrap: wrap; gap: .25rem; }
header nav a { display: inline-flex; align-items: center; gap: .45rem; color: #fff; text-decoration: none; font-weight: 600; padding: .5rem .8rem; border-radius: 6px; }
header nav a:hover { background: rgba(255,255,255,.08); }
header nav a.on { background: var(--red); }
header nav a.ext { color: #cfcde9; font-weight: 500; }

/* hero + search */
.hero { background: var(--navy); color: #fff; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; background:
  radial-gradient(circle at 85% 20%, rgba(247,3,3,.22), transparent 42%),
  repeating-linear-gradient(135deg, rgba(255,255,255,.035) 0 1px, transparent 1px 14px); pointer-events: none; }
.hero .wrap { position: relative; padding-block: 3rem 3.25rem; display: grid; gap: 1rem; }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; color: var(--red-on-navy); }
.hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 800; }
.lede { color: #cfcde9; font-size: 1.125rem; max-width: 60ch; }
.search { display: flex; gap: .5rem; max-width: 680px; margin-top: .5rem; background: #fff; padding: .4rem; border-radius: 10px; box-shadow: 0 18px 40px -20px rgba(0,0,0,.6); }
.search input { flex: 1 1 auto; min-width: 0; border: 0; font: 600 1.1rem var(--f-body); letter-spacing: .03em; color: var(--ink); padding: .75rem .9rem; background: transparent; text-transform: uppercase; }
.search input::placeholder { text-transform: none; letter-spacing: 0; font-weight: 400; color: #8a88a8; }
.search input:focus { outline: none; }
.search:focus-within { box-shadow: 0 0 0 3px var(--red), 0 18px 40px -20px rgba(0,0,0,.6); }
.search button { display: inline-flex; align-items: center; gap: .5rem; border: 0; border-radius: 7px; background: var(--red); color: #fff; font: 700 1rem var(--f-display); padding: 0 1.4rem; cursor: pointer; }
.search button:hover { filter: brightness(1.08); }
.switch { color: #cfcde9; font-size: .95rem; }
.switch a { color: #fff; font-weight: 600; }
@media (max-width: 480px) { .search button span { display: none; } .search button { padding: 0 1rem; } }

/* results */
.result { padding-block: 2rem 3.5rem; display: grid; gap: 1.25rem; }
.notice { padding: 1rem 1.2rem; border-radius: 8px; background: var(--soft); border-left: 4px solid var(--navy); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.notice.warn { background: #fff0f0; border-left-color: var(--red); }
.notice.ok { background: var(--ok-soft); border-left-color: var(--ok); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.5rem; display: grid; gap: 1rem; align-content: start; min-width: 0; }
.card h2 { font-size: 1.35rem; }
.card h3 { font-size: 1.15rem; }
.k { display: block; font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.summary { gap: 1.5rem; border-top: 4px solid var(--navy); }
.sum-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.tno { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; word-break: break-all; }
.pill { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; font-size: .95rem; padding: .4rem .9rem; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; }
.pill.go { background: var(--soft); color: var(--navy); }
.pill.go::before { background: var(--red); animation: blink 1.6s ease-in-out infinite; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.hold { background: var(--hold-soft); color: var(--hold); }
.pill.sm { font-size: .82rem; padding: .2rem .6rem; }
@keyframes blink { 50% { opacity: .25; } }

.route { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, 2fr) minmax(0, 1fr); align-items: center; gap: 1rem; }
.route .end b { display: block; font: 700 1.1rem/1.25 var(--f-display); }
.route .to { text-align: right; }
.track { position: relative; height: 34px; }
.track .line, .track .fill { position: absolute; left: 0; top: 50%; height: 3px; border-radius: 3px; transform: translateY(-50%); }
.track .line { right: 0; background: repeating-linear-gradient(90deg, var(--line) 0 8px, transparent 8px 14px); }
.track .fill { width: var(--pct); background: var(--red); animation: grow 1.2s cubic-bezier(.2,.8,.2,1) both; }
.track .vehicle { position: absolute; top: 50%; left: var(--pct); transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--red); animation: slide 1.2s cubic-bezier(.2,.8,.2,1) both; }
.track .vehicle svg { width: 18px; height: 18px; }
@keyframes grow { from { width: 0; } }
@keyframes slide { from { left: 0; } }
@media (max-width: 560px) { .route { grid-template-columns: 1fr 1fr; } .track { grid-column: 1 / -1; grid-row: 2; } }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; counter-reset: s; }
.steps li { display: grid; gap: .45rem; font-size: .9rem; font-weight: 600; color: var(--muted); }
.steps li span { height: 6px; border-radius: 3px; background: var(--line); }
.steps li.done { color: var(--ink); }
.steps li.done span { background: var(--navy); }
.steps li.now { color: var(--red-text); }
.steps li.now span { background: var(--red); }
@media (max-width: 520px) { .steps li { font-size: .75rem; } }

.facts { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.facts b { display: block; font: 700 1.05rem var(--f-display); }
.facts small { color: var(--muted); }
.holdnote { background: var(--hold-soft); color: var(--hold); padding: .8rem 1rem; border-radius: 8px; font-weight: 600; }
.pubnote { background: var(--soft); padding: .8rem 1rem; border-radius: 8px; }

.cols { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 820px) { .cols { grid-template-columns: 1fr; } }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { position: relative; padding: 0 0 1.25rem 1.6rem; display: grid; gap: .15rem; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: -8px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--navy); }
.timeline li.first::after { background: var(--red); border-color: var(--red); box-shadow: 0 0 0 4px rgba(247,3,3,.15); }
.timeline time { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline b { font-family: var(--f-display); }
.timeline .loc { display: inline-flex; align-items: center; gap: .3rem; font-size: .95rem; }
.timeline .loc svg { color: var(--red); width: .95em; height: .95em; }
.timeline p { color: var(--muted); font-size: .95rem; }

.details { margin: 0; display: grid; }
.details div { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.details div:last-child { border-bottom: 0; }
.details dt { color: var(--muted); font-size: .95rem; }
.details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 420px) { .details div { grid-template-columns: 1fr; gap: 0; } }
.help { font-size: .95rem; color: var(--muted); padding-top: .5rem; border-top: 1px solid var(--line); }

.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.how div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.4rem; display: grid; gap: .5rem; align-content: start; }
.how b { width: 2rem; height: 2rem; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-family: var(--f-display); }
.how p { color: var(--muted); }
@media (max-width: 760px) { .how { grid-template-columns: 1fr; } }

.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.mode { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .5rem 1.1rem; padding: 1.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); transition: border-color .2s, transform .2s, box-shadow .2s; }
.mode:hover { border-color: var(--navy); transform: translateY(-2px); box-shadow: 0 16px 32px -20px rgba(38,33,97,.5); }
.mode .ic { grid-row: span 2; width: 56px; height: 56px; border-radius: 12px; background: var(--navy); color: #fff; display: grid; place-items: center; }
.mode .ic svg { width: 28px; height: 28px; }
.mode b { display: block; font: 800 1.35rem var(--f-display); }
.mode small { display: block; color: var(--muted); font-size: 1rem; margin-top: .2rem; }
.mode .go { color: var(--red-text); font-weight: 700; }
@media (max-width: 680px) { .modes { grid-template-columns: 1fr; } }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: .45rem; border: 0; border-radius: 7px; background: var(--navy); color: #fff; font: 700 .95rem var(--f-display); padding: .7rem 1.1rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--navy-2); }
.btn.ghost { background: transparent; color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--navy); }
.btn.ghost:hover { background: var(--soft); }
.btn.red { background: var(--red); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--red-text); font: inherit; font-size: .88rem; cursor: pointer; text-decoration: underline; justify-self: start; }

/* admin */
.is-admin main { padding-block: 2rem 3.5rem; }
.admin { display: grid; gap: 1.25rem; }
.admin h1 { font-size: 1.8rem; }
.mono-h { font-variant-numeric: tabular-nums; letter-spacing: .02em; margin-top: .35rem; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1rem; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.crumbs a { text-decoration: none; font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.tiles div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; }
.tiles b { display: block; font: 800 1.8rem/1 var(--f-display); font-variant-numeric: tabular-nums; }
.tiles span { color: var(--muted); font-size: .92rem; }
.tiles .alert { border-color: var(--hold); background: var(--hold-soft); }
@media (max-width: 640px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filters input { flex: 1 1 260px; min-width: 0; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 7px; padding: .6rem .75rem; width: 100%; }
.filters select { width: auto; }
input:focus, select:focus, textarea:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgba(38,33,97,.15); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: .97rem; }
th { text-align: left; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: .8rem 1rem; border-bottom: 1px solid var(--line); background: #fafafd; }
td { padding: .75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.mono a { font-weight: 700; font-variant-numeric: tabular-nums; text-decoration: none; }
.nowrap { white-space: nowrap; }
.modetag { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; font-weight: 700; padding: .2rem .55rem; border-radius: 5px; background: var(--soft); color: var(--navy); }
.modetag.air { background: #fff0f0; color: var(--red-text); }
.empty { text-align: center; padding-block: 2.5rem; justify-items: center; }
.login label, .field label { font-weight: 600; font-size: .95rem; }
.login { gap: .6rem; }
.login h1 { font-size: 1.5rem; }
.login .btn { margin-top: .6rem; justify-content: center; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 1rem 1.25rem; }
.field { display: grid; gap: .3rem; align-content: start; min-width: 0; }
.field small { color: var(--muted); font-size: .85rem; }
.field small.err { color: var(--red-text); font-weight: 600; }
.field.has-error input, .field.has-error select { border-color: var(--red); }
.event-form { background: var(--soft); padding: 1rem; border-radius: 8px; }
.event-form .wide { grid-column: span 2; }
@media (max-width: 560px) { .event-form .wide { grid-column: auto; } }
.admin-tl li { padding-bottom: 1rem; }
.form-actions { display: flex; justify-content: flex-end; }
.danger { border-color: #f3c2c2; }
.danger .btn, .card > .btn { justify-self: start; }

footer.site { background: var(--navy-deep); color: #bdbae0; font-size: .9rem; }
footer.site .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1.5rem; padding-block: 1.25rem; }
footer.site a { color: #fff; text-decoration: none; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
