:root {
  --bg: #f2f2f7; --card: #fff; --text: #111; --muted: #6b6b70; --line: #e3e3e8; --accent: #e8590c;
  --green: #2f9e44; --blue: #1c7ed6; --orange: #f08c00; --red: #e03131; --gray: #868e96; --purple: #7048e8;
  --radius: 14px; --safe-top: env(safe-area-inset-top); --safe-bottom: env(safe-area-inset-bottom);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000; --card: #1c1c1e; --text: #f2f2f7; --muted: #98989f; --line: #2c2c2e; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.wrap { max-width: 640px; margin: 0 auto; padding: calc(var(--safe-top) + 8px) 16px calc(var(--safe-bottom) + 32px); }
header.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0 4px; }
header.bar h1 { font-size: 32px; font-weight: 800; margin: 0; letter-spacing: -0.5px; }
header.bar .actions { display: flex; gap: 6px; }
.icon-btn { border: 0; background: var(--card); width: 40px; height: 40px; border-radius: 50%; font-size: 20px;
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.icon-btn.primary { background: var(--accent); color: #fff; }
.back { border: 0; background: none; color: var(--accent); font-size: 17px; padding: 8px 0; cursor: pointer; }
h2.section { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 22px 4px 8px; font-weight: 600; }
.list { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line);
  cursor: pointer; text-decoration: none; color: inherit; }
.row:last-child { border-bottom: 0; }
.row:active { background: var(--line); }
.badge { flex: 0 0 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  font-weight: 800; text-align: center; line-height: 1; }
.badge .n { font-size: 22px; } .badge .u { font-size: 10px; font-weight: 600; text-transform: uppercase; opacity: .9; display: block; margin-top: 2px; }
.badge.s-delivered { background: var(--green); } .badge.s-out_for_delivery { background: var(--orange); }
.badge.s-in_transit { background: var(--blue); } .badge.s-pre_transit { background: var(--purple); }
.badge.s-exception, .badge.s-returned { background: var(--red); } .badge.s-unknown, .badge.s-cancelled { background: var(--gray); }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--line); color: var(--muted); margin-right: 6px; vertical-align: 1px; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-top: 12px; }
.detail-head { display: flex; gap: 14px; align-items: center; }
.detail-head .badge { flex-basis: 64px; height: 64px; }
.detail-head h2 { margin: 0; font-size: 22px; }
.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 15px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-all; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.timeline li:first-child::before { background: var(--accent); }
.timeline .when { color: var(--muted); font-size: 13px; }
.items { margin: 0; padding-left: 18px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn { border: 0; border-radius: 10px; padding: 10px 14px; background: var(--line); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--text); display: inline-block; }
.btn.primary { background: var(--accent); color: #fff; } .btn.danger { color: var(--red); }
.btn:disabled { opacity: .5; }
label.field { display: block; margin: 12px 0; } label.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], select, textarea { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
textarea { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; min-height: 160px; }
.hint { color: var(--muted); font-size: 14px; } .error { color: var(--red); font-size: 14px; }
ol.steps { padding-left: 20px; } ol.steps li { margin-bottom: 8px; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--line); padding: 1px 4px; border-radius: 4px; word-break: break-all; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-bottom) + 20px); background: rgba(30,30,30,.92);
  color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 15px; max-width: 90vw; z-index: 10; }
.login { max-width: 360px; margin: 18vh auto 0; text-align: center; }
.login img { width: 84px; height: 84px; border-radius: 20px; }
.spin { animation: spin 1s linear infinite; display: inline-block; } @keyframes spin { to { transform: rotate(360deg); } }
.card > h2.section:first-child { margin-top: 0; }
.card > h2.section { margin-left: 0; }
.kv dd.muted { color: var(--muted); }
.btns.even > * { flex: 1 1 0; text-align: center; min-width: 0; white-space: nowrap; }
.btns.even + .btns.even { margin-top: 8px; }
code.block { display: block; margin: 4px 0; padding: 4px 6px; width: fit-content; max-width: 100%; }
.login .btn { width: 100%; padding: 13px 14px; font-size: 17px; }
.login input { margin-top: 8px; }
