/* ============================================================================
   Raptors tracking — the waybill look.

   Deliberately NOT the PSL page this feature was referenced from: light flat
   cards in the control-panel spirit instead of a dark gradient hero, a
   segmented journey meter instead of a dot stepper, mdi icons instead of
   emoji, and the app's own status pills. Everything is rf- prefixed and
   self-contained so the page renders identically inside the app shell and
   standalone for guests.
   ========================================================================= */

.rf-track {
    --rf-amber: #f2b21b;
    --rf-ink: #111111;
    --rf-text: #1f2733;
    --rf-muted: #6b7280;
    --rf-line: #e7e9ee;
    --rf-soft: #f6f7f9;
    --rf-card: #ffffff;
    color: var(--rf-text);
}

.rf-track * { box-sizing: border-box; }
.rf-track a { text-decoration: none; }

/* Standalone (guest) chrome only */
body.rf-standalone { background: var(--rf-soft); margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
.rf-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px clamp(16px, 4vw, 40px); background: #fff;
    border-bottom: 1px solid var(--rf-line);
}
.rf-topbar img { max-height: 38px; width: auto; }
.rf-topbar nav { display: flex; gap: 8px; }
.rf-shell-standalone { max-width: 1140px; margin: 0 auto; padding: 22px clamp(14px, 3vw, 32px) 60px; }

/* Buttons */
.rf-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 16px; border-radius: 8px; border: 1px solid var(--rf-ink);
    font-weight: 700; font-size: .85rem; cursor: pointer;
    background: var(--rf-ink); color: #fff; transition: opacity .15s ease;
}
.rf-btn:hover { opacity: .85; color: #fff; }
.rf-btn--ghost { background: #fff; color: var(--rf-ink); }
.rf-btn--ghost:hover { color: var(--rf-ink); background: var(--rf-soft); opacity: 1; }

/* Cards */
.rf-card {
    background: var(--rf-card); border: 1px solid var(--rf-line);
    border-radius: 10px; box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
    margin-bottom: 18px; overflow: hidden;
}
.rf-card__pad { padding: 18px 20px; }
.rf-card__title {
    display: flex; align-items: center; gap: 8px;
    padding: 13px 20px; border-bottom: 1px solid var(--rf-line);
    font-size: .74rem; font-weight: 800; letter-spacing: .08em;
    text-transform: uppercase; color: var(--rf-muted);
}
.rf-card__title .mdi { color: var(--rf-amber); font-size: 1rem; }

/* ── Waybill header ─────────────────────────────────────────────────────── */
.rf-head {
    display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
    justify-content: space-between; padding: 20px 22px;
    border-left: 4px solid var(--rf-amber);
}
.rf-head__label {
    font-size: .7rem; font-weight: 800; letter-spacing: .12em;
    text-transform: uppercase; color: var(--rf-muted); margin: 0 0 4px;
}
.rf-head__code { margin: 0; font-size: clamp(1.3rem, 3.4vw, 1.9rem); font-weight: 800; color: var(--rf-ink); letter-spacing: .01em; }
.rf-head__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.rf-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 11px; border-radius: 999px; font-size: .74rem; font-weight: 700;
    background: #f9fafb; border: 1px solid var(--rf-line); color: var(--rf-text);
}
.rf-chip .mdi { color: var(--rf-amber); }
.rf-chip--link:hover { border-color: var(--rf-amber); }
.rf-head__side { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; }
.rf-head__side .rf-updated { font-size: .74rem; color: var(--rf-muted); }
@media (max-width: 640px) { .rf-head__side { align-items: flex-start; } }

/* ── Journey meter: five segments, filled like a gauge ──────────────────── */
.rf-meter { padding: 18px 20px 14px; }
.rf-meter__bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.rf-meter__seg { height: 9px; border-radius: 5px; background: #eef0f3; position: relative; overflow: hidden; }
.rf-meter__seg.is-done::after,
.rf-meter__seg.is-now::after {
    content: ""; position: absolute; inset: 0; border-radius: 5px;
    background: var(--rf-amber); transform: scaleX(0); transform-origin: left;
    animation: rf-seg .5s ease forwards;
}
.rf-meter__seg.is-now::after { background: var(--rf-ink); }
.rf-meter__seg:nth-child(2)::after { animation-delay: .12s; }
.rf-meter__seg:nth-child(3)::after { animation-delay: .24s; }
.rf-meter__seg:nth-child(4)::after { animation-delay: .36s; }
.rf-meter__seg:nth-child(5)::after { animation-delay: .48s; }
@keyframes rf-seg { to { transform: scaleX(1); } }

.rf-meter__labels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 9px; }
.rf-meter__step { text-align: center; font-size: .72rem; font-weight: 700; color: #9aa1ab; }
.rf-meter__step .mdi { display: block; font-size: 1.05rem; margin-bottom: 2px; }
.rf-meter__step.is-done { color: var(--rf-text); }
.rf-meter__step.is-done .mdi { color: var(--rf-amber); }
.rf-meter__step.is-now { color: var(--rf-ink); }
.rf-meter__step.is-now .mdi { color: var(--rf-ink); }
@media (max-width: 560px) { .rf-meter__step { font-size: .6rem; } }

/* ── Two-column body ────────────────────────────────────────────────────── */
.rf-grid { display: grid; grid-template-columns: 7fr 5fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .rf-grid { grid-template-columns: 1fr; } }

/* Route */
#rf-map { height: 300px; width: 100%; background: #eef2f6; }
.rf-map-fallback {
    display: none; padding: 26px 20px; text-align: center; color: var(--rf-muted);
    background: var(--rf-soft); font-size: .86rem;
}
.rf-map-fallback.show { display: block; }
.rf-route {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 20px; border-top: 1px solid var(--rf-line);
}
.rf-route__pt { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: .85rem; }
.rf-route__pt small { display: block; font-weight: 500; color: var(--rf-muted); font-size: .72rem; }
.rf-route__pt .mdi { color: var(--rf-amber); font-size: 1.1rem; }
.rf-route__pt--b .mdi { color: var(--rf-ink); }
.rf-route__line { flex: 1; border-top: 2px dashed #d4d9e0; position: relative; }
.rf-route__line .mdi {
    position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
    background: #fff; padding: 0 6px; color: var(--rf-muted); font-size: 1rem;
}

/* Journey timeline (history) */
.rf-tl { list-style: none; margin: 0; padding: 4px 0 0; }
.rf-tl li { position: relative; padding: 0 0 18px 26px; }
.rf-tl li::before {
    content: ""; position: absolute; left: 7px; top: 6px; bottom: -2px;
    width: 2px; background: #eef0f3;
}
.rf-tl li:last-child::before { display: none; }
.rf-tl__dot {
    position: absolute; left: 2px; top: 4px; width: 12px; height: 12px;
    border-radius: 50%; background: #fff; border: 3px solid #cbd2d9;
}
.rf-tl li.is-latest .rf-tl__dot { border-color: var(--rf-status, var(--rf-amber)); background: var(--rf-status, var(--rf-amber)); }
.rf-tl__when { font-size: .72rem; font-weight: 700; color: var(--rf-muted); }
.rf-tl__what { font-weight: 800; font-size: .92rem; margin: 1px 0; }
.rf-tl li.is-latest .rf-tl__what { color: var(--rf-ink); }
.rf-tl__where { font-size: .8rem; color: var(--rf-muted); }
.rf-tl__note {
    margin-top: 5px; font-size: .8rem; color: var(--rf-text);
    background: var(--rf-soft); border-left: 3px solid var(--rf-amber);
    padding: 6px 10px; border-radius: 0 6px 6px 0;
}

/* Detail rows */
.rf-rows { margin: 0; }
.rf-row {
    display: flex; justify-content: space-between; gap: 14px;
    padding: 9px 0; border-bottom: 1px dashed var(--rf-line);
    font-size: .87rem;
}
.rf-row:last-child { border-bottom: 0; }
.rf-row dt { color: var(--rf-muted); font-weight: 600; margin: 0; }
.rf-row dd { margin: 0; font-weight: 700; text-align: right; word-break: break-word; }

/* Parties */
.rf-party { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px dashed var(--rf-line); }
.rf-party:last-child { border-bottom: 0; }
.rf-party .mdi { font-size: 1.25rem; color: var(--rf-amber); margin-top: 2px; }
.rf-party--b .mdi { color: var(--rf-ink); }
.rf-party__who { font-weight: 800; font-size: .9rem; }
.rf-party__role { font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--rf-muted); }
.rf-party__where { font-size: .8rem; color: var(--rf-muted); margin-top: 2px; }

/* Files */
.rf-files { list-style: none; margin: 0; padding: 0; }
.rf-files li { padding: 7px 0; border-bottom: 1px dashed var(--rf-line); font-size: .86rem; }
.rf-files li:last-child { border-bottom: 0; }
.rf-files a { color: var(--rf-text); font-weight: 700; }
.rf-files a:hover { color: var(--rf-amber); }
.rf-files .mdi { color: var(--rf-amber); margin-right: 6px; }
.rf-photo { width: 100%; border-radius: 8px; display: block; margin-bottom: 10px; }

/* Member packages (consolidation view) */
.rf-members { display: flex; flex-wrap: wrap; gap: 8px; }
.rf-members a {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 13px; border: 1px solid var(--rf-line); border-radius: 8px;
    font-weight: 700; font-size: .84rem; color: var(--rf-text); background: #fff;
}
.rf-members a:hover { border-color: var(--rf-amber); }
.rf-members .mdi { color: var(--rf-amber); }

/* Not found */
.rf-missing { text-align: center; padding: 46px 20px; }
.rf-missing .mdi { font-size: 3.4rem; color: var(--rf-amber); }
.rf-missing h2 { margin: 10px 0 6px; font-weight: 800; color: var(--rf-ink); }
.rf-missing p { color: var(--rf-muted); max-width: 46ch; margin: 0 auto 6px; }
.rf-missing__code {
    display: inline-block; margin: 12px 0 4px; padding: 7px 16px;
    border: 1px dashed #c8ccd4; border-radius: 8px; font-weight: 800;
    background: var(--rf-soft); word-break: break-all;
}
.rf-missing__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }

/* Search page */
.rf-search { max-width: 620px; margin: 0 auto; }
.rf-search .rf-card__pad { padding: 26px 26px 22px; }
.rf-search h1 { margin: 0 0 4px; font-size: 1.45rem; font-weight: 800; color: var(--rf-ink); }
.rf-search p { margin: 0 0 18px; color: var(--rf-muted); font-size: .9rem; }
.rf-search__form { display: flex; gap: 9px; }
.rf-search__form input {
    flex: 1; min-height: 48px; border-radius: 8px; border: 1px solid #d4d9e0;
    background: #fff; padding: 0 15px; font: inherit; font-weight: 600; outline: none;
}
.rf-search__form input:focus { border-color: var(--rf-amber); box-shadow: 0 0 0 3px rgba(242, 178, 27, .18); }
.rf-search__hints { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 15px; }
@media (max-width: 480px) { .rf-search__form { flex-direction: column; } }

@media (prefers-reduced-motion: reduce) {
    .rf-track *, .rf-track *::before, .rf-track *::after { animation: none !important; transition: none !important; }
    .rf-meter__seg.is-done::after, .rf-meter__seg.is-now::after { transform: scaleX(1); }
}
