/* Tracking Map System - customer tracking view. ASCII only. */

.tms-track {
    --tms-navy: #1b3a6b;
    --tms-navy-dark: #12294c;
    --tms-accent: #c8102e;
    --tms-green: #1e7b34;
    --tms-amber: #b7791f;
    --tms-ink: #1f2933;
    --tms-muted: #5c6b7a;
    --tms-line: #dbe2ea;
    --tms-bg: #f4f6f9;
    max-width: 880px;
    margin: 0 auto;
    padding: 0 16px 40px;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: var(--tms-ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
.tms-track *, .tms-track *::before, .tms-track *::after { box-sizing: border-box; }

/* ---------- search ---------- */
.tms-search {
    background: #fff;
    border: 1px solid var(--tms-line);
    border-top: 4px solid var(--tms-navy);
    border-radius: 6px;
    padding: 28px 24px;
    margin: 24px 0;
}
.tms-search__title { margin: 0 0 6px; font-size: 26px; font-weight: 700; color: var(--tms-navy); letter-spacing: -0.2px; }
.tms-search__sub { margin: 0 0 20px; color: var(--tms-muted); font-size: 15px; }
.tms-search__label { display: block; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--tms-muted); margin-bottom: 8px; }
.tms-search__controls { display: flex; gap: 10px; flex-wrap: wrap; }
.tms-input {
    flex: 1 1 260px; min-width: 0; padding: 13px 14px; font-size: 16px;
    border: 1px solid #b6c1cd; border-radius: 4px; background: #fff; color: var(--tms-ink);
}
.tms-input:focus { outline: none; border-color: var(--tms-navy); box-shadow: 0 0 0 3px rgba(27,58,107,0.15); }
.tms-btn {
    padding: 13px 32px; font-size: 16px; font-weight: 700; color: #fff;
    background: var(--tms-navy); border: none; border-radius: 4px; cursor: pointer;
}
.tms-btn:hover { background: var(--tms-navy-dark); }
.tms-field-error { display: block; margin-top: 8px; color: var(--tms-accent); font-size: 13px; }

/* ---------- result shell ---------- */
.tms-result:empty { display: none; }
.tms-card {
    background: #fff; border: 1px solid var(--tms-line); border-radius: 6px;
    margin-bottom: 20px; overflow: hidden;
}
.tms-card__bar { height: 4px; background: var(--tms-navy); }
.tms-card__bar--delivered { background: var(--tms-green); }
.tms-card__bar--alert { background: var(--tms-accent); }
.tms-card__bar--hold { background: var(--tms-amber); }

.tms-tn { padding: 16px 24px; border-bottom: 1px solid var(--tms-line); background: #fbfcfd; }
.tms-tn__label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--tms-muted); }
.tms-tn__value { font-size: 20px; font-weight: 700; letter-spacing: 0.5px; word-break: break-all; }

/* ---------- status hero ---------- */
.tms-hero { padding: 26px 24px 8px; }
.tms-hero__status { font-size: 30px; font-weight: 700; line-height: 1.2; color: var(--tms-navy); margin: 0 0 10px; }
.tms-hero__status--delivered { color: var(--tms-green); }
.tms-hero__status--alert { color: var(--tms-accent); }
.tms-hero__status--hold { color: var(--tms-amber); }
.tms-hero__eta-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--tms-muted); }
.tms-hero__eta { font-size: 22px; font-weight: 700; margin: 2px 0 10px; }
.tms-hero__where { font-size: 15px; color: var(--tms-muted); margin: 0; }

/* ---------- milestone bar ---------- */
.tms-steps { display: flex; padding: 22px 24px 28px; gap: 0; }
.tms-step { flex: 1 1 0; position: relative; text-align: center; min-width: 0; }
.tms-step__dot {
    width: 16px; height: 16px; border-radius: 50%; background: #fff;
    border: 3px solid #c9d2dc; margin: 0 auto 10px; position: relative; z-index: 2;
}
.tms-step--done .tms-step__dot { background: var(--tms-navy); border-color: var(--tms-navy); }
.tms-step--current .tms-step__dot {
    background: var(--tms-navy); border-color: var(--tms-navy);
    box-shadow: 0 0 0 5px rgba(27,58,107,0.18);
}
.tms-steps--delivered .tms-step--done .tms-step__dot,
.tms-steps--delivered .tms-step--current .tms-step__dot { background: var(--tms-green); border-color: var(--tms-green); }
.tms-steps--delivered .tms-step--current .tms-step__dot { box-shadow: 0 0 0 5px rgba(30,123,52,0.18); }
.tms-step::before {
    content: ""; position: absolute; top: 8px; left: -50%; width: 100%;
    height: 3px; background: #c9d2dc; z-index: 1;
}
.tms-step:first-child::before { display: none; }
.tms-step--done::before, .tms-step--current::before { background: var(--tms-navy); }
.tms-steps--delivered .tms-step--done::before,
.tms-steps--delivered .tms-step--current::before { background: var(--tms-green); }
.tms-step__label { font-size: 12px; line-height: 1.3; color: var(--tms-muted); padding: 0 4px; display: block; }
.tms-step--done .tms-step__label, .tms-step--current .tms-step__label { color: var(--tms-ink); font-weight: 700; }

.tms-alert {
    margin: 0 24px 22px; padding: 12px 14px; border-radius: 4px; font-size: 14px;
    background: #fdf3f4; border-left: 4px solid var(--tms-accent); color: #7d1420;
}
.tms-alert--hold { background: #fdf8ed; border-left-color: var(--tms-amber); color: #7a5410; }
.tms-hold-contact { margin-top: 10px; font-weight: 700; overflow-wrap: anywhere; }
.tms-hold-contact a { color: inherit; text-decoration: underline; }
.tms-hold-notice { display: block; margin-top: 8px; font-size: 12px; line-height: 1.5; }

/* ---------- section heads ---------- */
.tms-section-head {
    padding: 14px 24px; font-size: 13px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.7px; color: var(--tms-navy); background: #fbfcfd;
    border-bottom: 1px solid var(--tms-line);
}

/* ---------- history timeline ---------- */
.tms-history { padding: 8px 24px 20px; }
.tms-hrow { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid #eef2f6; }
.tms-hrow:last-child { border-bottom: none; }
.tms-hrow__rail { position: relative; flex: 0 0 16px; }
.tms-hrow__dot {
    width: 12px; height: 12px; border-radius: 50%; background: #fff;
    border: 3px solid #c9d2dc; position: relative; z-index: 2; margin-top: 4px;
}
.tms-hrow--done .tms-hrow__dot { background: var(--tms-navy); border-color: var(--tms-navy); }
.tms-hrow--latest .tms-hrow__dot { background: var(--tms-green); border-color: var(--tms-green); box-shadow: 0 0 0 4px rgba(30,123,52,0.15); }
.tms-hrow__rail::after {
    content: ""; position: absolute; left: 4.5px; top: 18px; bottom: -18px; width: 3px; background: #e2e8ef;
}
.tms-hrow:last-child .tms-hrow__rail::after { display: none; }
.tms-hrow__body { flex: 1 1 auto; min-width: 0; }
.tms-hrow__status { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.tms-hrow--latest .tms-hrow__status { color: var(--tms-green); }
.tms-hrow__place { font-size: 14px; color: var(--tms-ink); word-break: break-word; }
.tms-hrow__time { font-size: 13px; color: var(--tms-muted); margin-top: 2px; }
.tms-hrow__pending { font-size: 12px; color: var(--tms-muted); font-style: italic; }

/* ---------- collapsible details ---------- */
.tms-acc { border-top: 1px solid var(--tms-line); }
.tms-acc summary {
    padding: 16px 24px; cursor: pointer; font-size: 15px; font-weight: 700;
    color: var(--tms-navy); list-style: none; display: flex; align-items: center; gap: 10px;
}
.tms-acc summary::-webkit-details-marker { display: none; }
.tms-acc summary::before { content: "+"; font-size: 18px; font-weight: 700; width: 14px; }
.tms-acc[open] summary::before { content: "-"; }
.tms-acc summary:hover { background: #fbfcfd; }
.tms-dl { margin: 0; padding: 0 24px 20px; }
.tms-dl__row { display: flex; gap: 16px; padding: 9px 0; border-bottom: 1px solid #f0f4f8; font-size: 14px; }
.tms-dl__row:last-child { border-bottom: none; }
.tms-dl__k { flex: 0 0 42%; color: var(--tms-muted); }
.tms-dl__v { flex: 1 1 auto; font-weight: 600; word-break: break-word; }

.tms-empty { padding: 30px 24px; text-align: center; color: var(--tms-muted); font-size: 15px; }
.tms-error {
    margin: 20px 0; padding: 16px 18px; border-radius: 6px; background: #fdf3f4;
    border: 1px solid #f0c4ca; border-left: 4px solid var(--tms-accent); color: #7d1420; font-size: 15px;
}

/* ---------- map ---------- */
.tms-map-wrap { background: #fff; border: 1px solid var(--tms-line); border-radius: 6px; overflow: hidden; margin-bottom: 20px; }
#map { height: 420px; width: 100%; }
#progress-controls { padding: 18px 24px 22px; }
#progress-bar-container { position: relative; height: 34px; background: #eef2f6; border-radius: 4px; overflow: hidden; }
#progress-bar { position: absolute; top: 0; left: 0; width: 0; height: 100%; z-index: 1; transition: width 0.6s linear, left 0.6s linear; }
#progress-segments { position: relative; width: 100%; height: 100%; z-index: 2; display: flex; }
.progress-segment {
    line-height: 34px; font-size: 11px; color: var(--tms-ink); text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px;
    border-right: 1px solid #fff;
}
.progress-segment:last-child { border-right: none; }
.tms-eta { font-size: 14px; color: var(--tms-navy); margin: 10px 0 0; font-weight: 600; }

.package-icon-9274 {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--tms-accent); border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* ---------- loading ---------- */
.loading-indicator { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 20px; color: var(--tms-muted); font-size: 15px; }
.spinner {
    width: 20px; height: 20px; border: 3px solid #d9e0e8; border-top-color: var(--tms-navy);
    border-radius: 50%; animation: tmsspin 0.8s linear infinite;
}
@keyframes tmsspin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
    .tms-search { padding: 20px 16px; }
    .tms-search__title { font-size: 22px; }
    .tms-hero { padding: 20px 16px 6px; }
    .tms-hero__status { font-size: 23px; }
    .tms-hero__eta { font-size: 18px; }
    .tms-tn, .tms-section-head, .tms-alert { padding-left: 16px; padding-right: 16px; }
    .tms-alert { margin-left: 16px; margin-right: 16px; }
    .tms-steps { padding: 18px 8px 22px; }
    .tms-step__label { font-size: 10px; }
    .tms-history { padding: 4px 16px 16px; }
    .tms-acc summary { padding: 14px 16px; }
    .tms-dl { padding: 0 16px 16px; }
    .tms-dl__row { flex-direction: column; gap: 2px; }
    .tms-dl__k { flex: none; }
    #map { height: 300px; }
}
