/* ---------- tokens ---------- */
:root {
  --ink: #12303b;        /* deep harbour water - text, header */
  --sea: #0e6b78;        /* primary actions, route line */
  --sea-dark: #0a525c;
  --shallows: #dcedeb;   /* tinted panels */
  --paper: #f7faf9;      /* page */
  --white: #ffffff;
  --sun: #f2b21b;        /* the parcel - current position */
  --alert: #b73a2e;      /* holds and errors */
  --alert-bg: #fbecea;
  --line: #c9dcda;
  --muted: #557079;
  --radius-s: 6px;
  --radius-l: 14px;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.2rem;
  --step-4: clamp(2.4rem, 6vw, 4.2rem);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--sea); text-underline-offset: 3px; }
a:hover { color: var(--sea-dark); }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 4px; }
.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { line-height: 1.1; margin: 0 0 .5em; font-stretch: 112%; font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); font-weight: 700; font-stretch: 100%; letter-spacing: 0; }
p { margin: 0 0 1em; max-width: 62ch; }

/* ---------- header / footer ---------- */
.site-header { background: var(--ink); color: var(--white); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { color: var(--white); text-decoration: none; font-weight: 800; font-stretch: 120%; font-size: 1.15rem; display: flex; align-items: center; gap: 10px; }
.brand:hover { color: var(--white); }
.brand-mark { width: 26px; height: 26px; flex: none; }
.site-header nav { display: flex; gap: 20px; font-size: var(--step--1); }
.site-header nav a { color: #cfe3e1; text-decoration: none; }
.site-header nav a:hover { color: var(--white); text-decoration: underline; }

.site-footer { margin-top: 80px; border-top: 1px solid var(--line); padding: 32px 0 48px; color: var(--muted); font-size: var(--step--1); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 32px; justify-content: space-between; }
.site-footer p { margin: 0; }

/* ---------- forms & buttons ---------- */
label { display: block; font-weight: 600; font-size: var(--step--1); margin-bottom: 6px; }
input, select, textarea {
  font: inherit; color: inherit; width: 100%;
  background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius-s);
  padding: 10px 12px; min-height: 44px;
}
input:focus, select:focus, textarea:focus { border-color: var(--sea); outline: none; box-shadow: 0 0 0 3px rgba(14,107,120,.18); }
textarea { min-height: 84px; resize: vertical; }
.hint { color: var(--muted); font-size: var(--step--1); margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  background: var(--sea); color: var(--white); border: 0; border-radius: var(--radius-s);
  padding: 10px 18px; min-height: 44px;
}
.btn:hover { background: var(--sea-dark); color: var(--white); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-quiet { background: transparent; color: var(--sea); border: 1.5px solid var(--line); }
.btn-quiet:hover { background: var(--shallows); color: var(--sea-dark); }
.btn-danger { background: transparent; color: var(--alert); border: 1.5px solid #e6c2bd; }
.btn-danger:hover { background: var(--alert-bg); color: var(--alert); }
.btn-small { min-height: 34px; padding: 4px 12px; font-size: var(--step--1); }

/* ---------- tracking search ---------- */
.track-form { display: flex; gap: 8px; max-width: 560px; }
.track-form input {
  font-size: 1.3rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  min-height: 58px; padding-inline: 16px; border-width: 2px;
}
.track-form input::placeholder { text-transform: none; letter-spacing: 0; font-weight: 400; color: #8aa1a8; }
.track-form .btn { min-height: 58px; padding-inline: 26px; font-size: 1.1rem; }
.form-error { color: var(--alert); font-weight: 600; margin-top: 8px; min-height: 1.5em; font-size: var(--step--1); }

/* ---------- home hero ---------- */
.hero { background: var(--ink); color: var(--white); padding: 56px 0 0; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
.hero h1 { color: var(--white); max-width: 11ch; }
.hero .lede { color: #cfe3e1; font-size: var(--step-1); max-width: 36ch; }
.hero .track-form input { border-color: transparent; }
.hero .form-error { color: #ffb4a8; }
.hero .hint { color: #9dbcbf; }
.hero-map { margin-top: 8px; margin-inline: -16px; }
.hero-map svg { width: 100%; height: auto; }
@media (min-width: 900px) {
  .hero { padding-top: 80px; }
  .hero-grid { grid-template-columns: 1.05fr 1fr; align-items: end; }
  .hero-copy { padding-bottom: 72px; }
  .hero-map { margin: 0 -40px 0 0; }
}
.map-label { font-family: var(--font); font-size: 15px; font-weight: 700; fill: #ffffff; }
.map-sub { font-family: var(--font); font-size: 12px; fill: #9dbcbf; }

/* ---------- how it works ---------- */
.steps { padding: 72px 0 0; }
.steps ol { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 32px; counter-reset: step; }
@media (min-width: 800px) { .steps ol { grid-template-columns: repeat(3, 1fr); } }
.steps li { counter-increment: step; border-top: 3px solid var(--ink); padding-top: 16px; }
.steps li::before { content: counter(step); display: block; font-weight: 800; font-stretch: 125%; font-size: 2.4rem; line-height: 1; color: var(--sea); margin-bottom: 12px; }
.steps address { font-style: normal; background: var(--shallows); border-radius: var(--radius-s); padding: 10px 12px; white-space: pre-line; font-size: var(--step--1); }

/* ---------- route strip (tracking progress) ---------- */
.route { list-style: none; margin: 32px 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); position: relative; }
.route li { position: relative; text-align: center; font-size: .8rem; color: var(--muted); padding-top: 34px; line-height: 1.25; }
.route li::before { /* the line segment to the left of each stop */
  content: ''; position: absolute; top: 12px; right: 50%; width: 100%; height: 4px; background: var(--line);
}
.route li:first-child::before { display: none; }
.route li::after { /* the stop */
  content: ''; position: absolute; top: 6px; left: 50%; translate: -50% 0; width: 16px; height: 16px;
  border-radius: 50%; background: var(--paper); border: 3px solid var(--line); box-sizing: border-box;
}
.route li.done { color: var(--ink); }
.route li.done::before, .route li.current::before { background: var(--sea); }
.route li.done::after { background: var(--sea); border-color: var(--sea); }
.route li.current { color: var(--ink); font-weight: 700; }
.route li.current::after { width: 30px; height: 30px; top: -1px; border-radius: 6px; background: var(--sun); border: 3px solid var(--ink); rotate: -6deg; }
.route.hold li.current::after { background: var(--alert); }
.route .route-label { display: block; padding-inline: 2px; }
@media (max-width: 520px) {
  .route li:not(.current) .route-label { visibility: hidden; }
  .route li.current .route-label { white-space: nowrap; }
  .route li:first-child.current .route-label { text-align: left; translate: calc(50% - 8px) 0; }
  .route li:last-child.current .route-label { text-align: right; translate: calc(-50% + 8px) 0; }
}

/* ---------- tracking result ---------- */
.track-top { padding: 32px 0 8px; border-bottom: 1px solid var(--line); background: var(--white); }
.track-top .track-form input { font-size: 1.05rem; min-height: 50px; }
.track-top .track-form .btn { min-height: 50px; }
.result { padding-top: 40px; }
.result-head { display: grid; gap: 4px; }
.tracking-number { font-weight: 700; font-stretch: 112%; letter-spacing: .08em; color: var(--muted); font-size: var(--step-0); }
.status-title { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0; }
.status-title.hold { color: var(--alert); }
.status-text { font-size: var(--step-1); margin: 8px 0 0; max-width: 48ch; }
.result-grid { display: grid; gap: 40px; margin-top: 16px; }
@media (min-width: 860px) { .result-grid { grid-template-columns: 1fr 300px; gap: 64px; } }

.facts { background: var(--shallows); border-radius: var(--radius-l); padding: 22px 24px; align-self: start; }
.facts dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; }
.facts dt { color: var(--muted); font-size: var(--step--1); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
.facts .pickup { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: var(--step--1); }
.facts .pickup p { margin: 0 0 4px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 112px 1fr; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.timeline time { color: var(--muted); font-size: var(--step--1); line-height: 1.4; }
.timeline time b { display: block; color: var(--ink); font-weight: 600; font-size: var(--step-0); }
.timeline .ev-title { font-weight: 700; margin: 0; }
.timeline li:first-child .ev-title::before { content: ''; display: inline-block; width: 10px; height: 10px; background: var(--sun); border: 2px solid var(--ink); border-radius: 2px; rotate: -6deg; margin-right: 8px; vertical-align: 1px; }
.timeline .ev-place { color: var(--muted); margin: 0; font-size: var(--step--1); }
.timeline .ev-note { margin: 6px 0 0; font-size: var(--step--1); background: var(--white); border-left: 3px solid var(--sun); padding: 6px 10px; }
.timeline .ev-hold .ev-title { color: var(--alert); }

.notice { border-radius: var(--radius-l); padding: 28px; background: var(--white); border: 1.5px solid var(--line); margin-top: 40px; }
.notice h2 { font-size: var(--step-2); }
.notice p:last-child { margin-bottom: 0; }

/* ---------- admin ---------- */
.admin-body { background: #eef4f3; }
.admin-main { padding: 32px 0 64px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; justify-content: space-between; margin-bottom: 20px; }
.toolbar h1 { font-size: var(--step-3); margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters input { width: 300px; max-width: 100%; }
.filters select { width: auto; }
.panel { background: var(--white); border-radius: var(--radius-l); border: 1px solid var(--line); padding: 24px; }
.panel + .panel { margin-top: 20px; }
.panel h2 { font-size: var(--step-1); font-stretch: 100%; font-weight: 700; letter-spacing: 0; margin-bottom: 16px; }

.table-wrap { overflow-x: auto; background: var(--white); border-radius: var(--radius-l); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); background: #f6faf9; white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f3f9f8; }
tbody tr:last-child td { border-bottom: 0; }
td .tn { font-weight: 700; letter-spacing: .05em; color: var(--ink); text-decoration: none; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--shallows); color: var(--sea-dark); font-weight: 600; white-space: nowrap; font-size: .8rem; }
.pill.s-delivered { background: var(--ink); color: var(--white); }
.pill.s-ready_pickup, .pill.s-out_for_delivery { background: #fdeec4; color: #6b4d00; }
.pill.s-on_hold { background: var(--alert-bg); color: var(--alert); }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty p { margin-inline: auto; }

.form-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .full { grid-column: 1 / -1; } }
fieldset { border: 0; padding: 0; margin: 0 0 28px; }
legend { font-weight: 700; font-size: var(--step-1); margin-bottom: 12px; padding: 0; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-row label { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: var(--step-0); border: 1.5px solid var(--line); border-radius: var(--radius-s); padding: 8px 14px; cursor: pointer; background: var(--white); margin: 0; }
.radio-row input { width: auto; min-height: 0; accent-color: var(--sea); }
.radio-row label:has(input:checked) { border-color: var(--sea); background: var(--shallows); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }

.detail-grid { display: grid; gap: 20px; }
@media (min-width: 960px) { .detail-grid { grid-template-columns: 1fr 360px; align-items: start; } }
.detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.detail-head h1 { font-size: var(--step-3); margin: 0; letter-spacing: .04em; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; margin: 0; font-size: var(--step--1); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; white-space: pre-line; }
.back { display: inline-block; margin-bottom: 16px; font-size: var(--step--1); }
.admin-events .timeline li { grid-template-columns: 100px 1fr auto; }
.toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; background: var(--ink); color: var(--white); padding: 12px 20px; border-radius: var(--radius-s); font-weight: 600; box-shadow: 0 8px 24px rgba(18,48,59,.25); z-index: 10; }
.login { max-width: 420px; margin: 72px auto; }
.login h1 { font-size: var(--step-3); }
