:root {
  --bg: #f4f4f1; --card: #fff; --ink: #1b1b19; --muted: #6f6f69; --line: #e3e3dd;
  --accent: #1b1b19; --urgent: #c2410c; --late: #b91c1c; --soon: #a16207; --ok: #15803d;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
main { max-width: 640px; margin: 0 auto; padding: 12px 14px calc(40px + env(safe-area-inset-bottom)); }
a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #e9e9e3; padding: 1px 6px; border-radius: 6px; font-size: .9em; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: rgba(244,244,241,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 1.15rem; text-decoration: none; letter-spacing: -.02em; }
.top nav { display: flex; gap: 16px; }
.top nav a { text-decoration: none; color: var(--muted); font-weight: 600; }
.pill { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--late); color: #fff; font-size: .75rem; text-align: center; }

h1.page { font-size: 1.4rem; margin: 8px 0 14px; letter-spacing: -.02em; }
h2.sub { font-size: 1rem; color: var(--muted); margin: 28px 0 8px; }
.back { display: inline-block; margin: 4px 0 10px; color: var(--muted); text-decoration: none; font-weight: 600; }
.hint { color: var(--muted); font-size: .85rem; text-align: center; margin-top: 24px; }
.empty { text-align: center; padding: 80px 10px; font-size: 1.2rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 12px 18px;
  background: var(--accent); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn.wide { width: 100%; padding: 15px; font-size: 1.05rem; }
.btn.small { padding: 8px 12px; font-size: .9rem; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.dark { background: #000; margin-top: 8px; }
.btn:active { transform: scale(.98); }
.link { background: none; border: 0; padding: 8px; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; }
.link.danger { color: var(--late); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: #e9e9e3; color: #444; white-space: nowrap; }
.tag.ok { background: #dcfce7; color: var(--ok); }
.tag.late { background: #fee2e2; color: var(--late); }
.c-vinted-go { background: #d6f0f1; color: #00646d; }
.c-mondial-relay { background: #f6dde7; color: #8b1446; }
.c-chronopost { background: #dbe6f7; color: #123d84; }
.c-dpd-pickup { background: #fbdcdc; color: #a1121b; }

.dl { font-size: .85rem; color: var(--muted); font-weight: 600; }
.dl.soon { color: var(--soon); }
.dl.urgent { color: var(--urgent); }
.dl.late { color: var(--late); }

.relays { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.relay { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--card); border-radius: var(--radius); text-decoration: none; border: 1px solid var(--line); }
.relay.muted { opacity: .55; }
.rl-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.rl-name { font-weight: 800; font-size: 1.05rem; }
.rl-addr { color: var(--muted); font-size: .9rem; }
.rl-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.rl-count { font-size: 2rem; font-weight: 800; min-width: 44px; text-align: center; }

.relay-head { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.relay-head h1 { margin: 0 0 6px; font-size: 1.35rem; }
.relay-head p { margin: 0 0 8px; }
.relay-head .summary { margin: 12px 0 0; font-size: 1.05rem; }

.parcel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; scroll-margin-top: 70px; }
.parcel.expired { opacity: .6; }
.p-top { display: flex; align-items: center; gap: 8px; }
.who { font-weight: 800; font-size: 1.1rem; }
.acct { color: var(--muted); font-size: .8rem; margin-top: 2px; word-break: break-all; }
.p-body { display: flex; gap: 16px; align-items: center; margin: 12px 0; }
.code-img { width: 132px; height: 132px; object-fit: contain; image-rendering: pixelated; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 4px; cursor: zoom-in; flex: none; }
.p-code { min-width: 0; }
.label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.code { display: block; background: none; border: 0; padding: 0; margin: 2px 0 4px; font: 800 2.1rem/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; color: var(--ink); cursor: zoom-in; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0 0 12px; font-size: .9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-word; }
.p-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.p-actions form:first-child { flex: 1; }

.row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; text-decoration: none; }
.row-main { flex: 1; min-width: 0; display: grid; gap: 3px; }

.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.box p { margin: 0 0 10px; }
.upload { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.upload input { flex: 1; min-width: 0; font-size: .85rem; }
.ok { color: var(--ok); font-weight: 600; }
.error { color: var(--late); font-weight: 600; }
.mailtext { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-top: 14px; font-size: .9rem; overflow-wrap: anywhere; }
.mailtext p { margin: 0 0 6px; }

.login { max-width: 340px; margin: 18vh auto 0; display: grid; gap: 12px; }
.login h1 { text-align: center; font-size: 2rem; margin: 0 0 8px; }
.login input { font: inherit; font-size: 1.1rem; padding: 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; }

#zoom { position: fixed; inset: 0; z-index: 50; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 20px; }
#zoom[hidden] { display: none; }
#zoom img { width: min(86vw, 62vh); height: auto; image-rendering: pixelated; }
#zoom img[hidden] { display: none; }
.zcode { font: 800 3.2rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .1em; }
.zhint { color: var(--muted); font-size: .85rem; }

.person { margin-bottom: 22px; }
.person-name { font-size: 1.15rem; margin: 18px 0 2px; letter-spacing: -.01em; }
.person > .acct { margin-bottom: 8px; }
.person > .parcel:first-of-type { margin-top: 8px; }
.parcel.group { border: 2px solid #00646d33; }
.items { list-style: none; margin: 8px 0 12px; padding: 0; border-top: 1px solid var(--line); }
.item { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 10px 0; background: none; border: 0; border-bottom: 1px solid var(--line);
  font: inherit; color: inherit; text-align: left; cursor: zoom-in; }
.item-name { font-weight: 600; }
.item-meta { display: flex; gap: 10px; align-items: baseline; font-size: .9rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
