:root {
    color-scheme: light;
    --bg: #f4f7f6;
    --ink: #17211f;
    --muted: #60706b;
    --line: #d7e0dc;
    --panel: #ffffff;
    --accent: #0f8b8d;
    --accent-dark: #0b6668;
    --warn: #9b3d1f;
    --done: #1f8a4c;
    --done-bg: #e8f6ec;
    --planned-bg: #f1f4f3;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: var(--accent-dark);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.site-header {
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.site-header .shell {
    padding: 14px 0;
}

.brand {
    display: inline-flex;
    align-items: center;
}

.brand-logo {
    height: 42px;
    width: auto;
    display: block;
}

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0;
}

.panel,
.hero,
.timeline,
.map-wrap,
.result-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(23, 33, 31, 0.06);
}

.intro {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
    gap: 32px;
    align-items: start;
    padding: 32px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--accent-dark);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    margin: 0 0 12px;
    font-size: clamp(2rem, 4vw, 4.25rem);
    line-height: 1;
}

p {
    color: var(--muted);
    line-height: 1.55;
}

.form {
    display: grid;
    gap: 14px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

label {
    display: grid;
    gap: 6px;
    color: #354541;
    font-size: 0.9rem;
    font-weight: 700;
}

input,
select,
button {
    width: 100%;
    min-height: 44px;
    border-radius: 6px;
    font: inherit;
}

input,
select {
    border: 1px solid var(--line);
    padding: 10px 12px;
    background: #fbfdfc;
    color: var(--ink);
}

button {
    border: 0;
    padding: 0 16px;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

button:hover {
    background: var(--accent-dark);
}

.result {
    margin-top: 18px;
}

.result-card {
    padding: 22px;
}

.code {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    margin: 8px 0;
    padding: 0 12px;
    border: 1px dashed var(--accent);
    border-radius: 6px;
    background: #edf9f8;
    font-family: Consolas, monospace;
    font-weight: 800;
}

.muted-note {
    font-size: 0.85rem;
    font-style: italic;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.actions a,
.actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 150px;
    min-height: 40px;
    border-radius: 6px;
    text-decoration: none;
}

.actions a {
    padding: 0 14px;
    background: #20312d;
    color: #fff;
    font-weight: 800;
}

.error {
    color: var(--warn);
    font-weight: 700;
}

.tracking .back {
    display: inline-block;
    margin-bottom: 14px;
}

/* Status hero */
.hero {
    padding: 22px 26px;
    margin-bottom: 18px;
}

.hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.code-badge {
    font-family: Consolas, monospace;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 999px;
    background: #edf9f8;
    color: var(--accent-dark);
    border: 1px solid var(--line);
}

.hero-status {
    margin: 12px 0 10px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
}

.hero-eta {
    margin: 10px 0 0;
    font-weight: 700;
    color: var(--accent-dark);
}

.progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: var(--planned-bg);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), var(--done));
    transition: width 0.3s ease;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.72rem;
    text-transform: uppercase;
}

.badge-completed {
    background: var(--done-bg);
    color: var(--done);
}

.badge-current {
    background: #edf9f8;
    color: var(--accent-dark);
}

.badge-planned {
    background: var(--planned-bg);
    color: #63716d;
}

.tracking-grid {
    display: grid;
    grid-template-columns: minmax(360px, 1.2fr) minmax(300px, 0.8fr);
    gap: 18px;
}

.timeline {
    padding: 20px;
    max-height: 620px;
    overflow-y: auto;
}

.timeline-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    font-weight: 800;
}

.timeline-title small {
    color: var(--muted);
    font-weight: 700;
}

.event {
    position: relative;
    padding: 0 0 14px 22px;
    border-left: 2px solid var(--line);
}

.event:last-child {
    padding-bottom: 0;
    border-left-color: transparent;
}

.event::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--line);
}

.event.completed::before {
    background: var(--done);
}

.event.current::before {
    background: var(--accent);
    box-shadow: 0 0 0 4px #edf9f8;
}

.event.planned {
    opacity: 0.5;
}

.event.planned strong,
.event.planned span {
    color: var(--muted);
}

.event em {
    position: absolute;
    left: -2px;
    top: 16px;
    color: var(--muted);
    font-size: 0.68rem;
    font-style: normal;
    font-weight: 800;
    transform: translateX(-50%);
}

.event strong {
    display: block;
    font-size: 0.95rem;
}

.event span,
.event time {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.84rem;
}

.event small.badge {
    width: fit-content;
    margin-top: 6px;
}

.map-wrap {
    min-height: 480px;
    padding: 14px;
}

#map {
    width: 100%;
    min-height: 420px;
    border-radius: 6px;
    border: 1px solid var(--line);
}

#map-note {
    margin: 10px 0 0;
    font-size: 0.88rem;
}

/* Leaflet map markers, arrows, legend */
.map-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-weight: 800;
    font-size: 0.75rem;
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(23, 33, 31, 0.35);
}

.marker-origin {
    background: var(--done);
}

.marker-destination {
    background: var(--warn);
}

.marker-hub {
    background: #6c7d78;
}

.marker-current {
    outline: 3px solid var(--accent);
}

.route-arrow {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid var(--accent);
}

.map-legend {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.78rem;
    line-height: 1.6;
    box-shadow: 0 4px 14px rgba(23, 33, 31, 0.15);
}

.map-legend strong {
    display: block;
    margin-bottom: 4px;
}

.legend-swatch {
    display: inline-block;
    width: 14px;
    height: 4px;
    margin-right: 6px;
    border-radius: 2px;
}

.legend-marker {
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
    vertical-align: middle;
    margin-right: 4px;
}

@media (max-width: 820px) {
    .intro,
    .tracking-grid,
    .grid {
        grid-template-columns: 1fr;
    }

    .tracking-grid {
        display: flex;
        flex-direction: column;
    }

    .shell {
        width: min(100% - 20px, 1120px);
        padding: 18px 0;
    }

    .intro,
    .hero {
        padding: 20px;
    }

    .map-wrap {
        min-height: 380px;
    }

    #map {
        min-height: 300px;
    }
}
