/* Shipdesk
   Layout: a sticky header with three tabs (People / Ship / Track).
   People is a master-detail view (list + one big current person).
   Ship is a paste box over an editable UPS sheet. Track is a saved-sheets
   list beside one sheet's tracking table. On phones everything stacks and
   the People actions sit in a bar at the bottom of the screen. */
:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --line: #dde2e8;
  --fg: #16202b;
  --muted: #637080;
  --accent: #c2410c;
  --on-accent: #ffffff;
  --accent-soft: #fdeee6;
  --used-fg: #9aa4b0;
  --used-bg: #eceff2;
  --ok: #15803d;
  --ok-soft: #e3f4e8;
  --warn: #a16207;
  --danger: #b91c1c;
  --from-bg: #f6f1ec;
  --shadow: 0 1px 2px rgba(22, 32, 43, .05), 0 4px 14px rgba(22, 32, 43, .05);
  --font-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161c; --surface: #19212a; --line: #2a3541; --fg: #e8edf2; --muted: #93a0ae;
    --accent: #fb8a4c; --on-accent: #1d0f06; --accent-soft: #3a2316; --used-fg: #5c6875; --used-bg: #151b22;
    --ok: #4ade80; --ok-soft: #14301f; --warn: #facc15; --danger: #f87171; --from-bg: #221d1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11161c; --surface: #19212a; --line: #2a3541; --fg: #e8edf2; --muted: #93a0ae;
  --accent: #fb8a4c; --on-accent: #1d0f06; --accent-soft: #3a2316; --used-fg: #5c6875; --used-bg: #151b22;
  --ok: #4ade80; --ok-soft: #14301f; --warn: #facc15; --danger: #f87171; --from-bg: #221d1a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.min0 { min-width: 0; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; margin-right: auto; }
.logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); flex: none; }
.title { font-family: var(--font-display); font-weight: 750; font-size: 22px; letter-spacing: -0.02em; line-height: 1.05; }
.tagline { font-size: 12.5px; color: var(--muted); }
.tabs { display: grid; grid-template-columns: repeat(3, auto); gap: 4px; padding: 4px; border-radius: 12px; background: var(--used-bg); border: 1px solid var(--line); }
.tabs button {
  min-height: 38px; padding: 0 18px; border: 0; border-radius: 9px; background: transparent; cursor: pointer;
  font-weight: 600; font-size: 14.5px; color: var(--muted);
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.count { font-weight: 500; font-variant-numeric: tabular-nums; color: var(--muted); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 640px) {
  .tagline { display: none; }
  .tabs { order: 3; width: 100%; grid-template-columns: repeat(3, 1fr); }
}

.wrap { max-width: 1320px; margin: 0 auto; padding-inline: 16px; padding-block: 18px 40px; }
.tabpanel { display: grid; gap: 16px; }

/* ---------- shared bits ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 600; font-size: 14px; min-height: 42px; padding: 0 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--fg); background: var(--used-bg); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font-size: 13.5px; }
input[type="search"], input[type="number"], select, textarea, .bname {
  font-size: 16px; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; min-height: 44px; min-width: 0;
}
input[type="search"] { width: 100%; }
textarea { width: 100%; min-height: 170px; padding: 12px 14px; resize: vertical; font-family: var(--font-mono); font-size: 14px; line-height: 1.5; }
.toggle {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 14px; cursor: pointer; user-select: none; white-space: nowrap;
}
.toggle input, td input[type="checkbox"], th input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.confirm { padding: 12px; border-radius: 10px; background: var(--accent-soft); display: grid; gap: 10px; font-size: 14px; }
.confirm p { margin: 0; }
.pair { display: flex; flex-wrap: wrap; gap: 8px; }
.pair .btn { flex: 1 1 120px; }
.note { margin: 0; font-size: 13.5px; color: var(--muted); }
.note b { color: var(--fg); }
.status { font-size: 13.5px; color: var(--muted); }
.status.err { color: var(--danger); }
.k { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.k b { color: var(--fg); font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.listhead { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 4px 4px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.listhead b { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); }
.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge.new { color: var(--muted); background: var(--bg); }
.badge.part { color: var(--accent); background: var(--accent-soft); }
.badge.done { color: var(--ok); box-shadow: inset 0 0 0 1px currentColor; }
.badge.ship { color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
kbd { font-family: var(--font-mono); font-size: 11.5px; padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--bg); }

/* ---------- people ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; }
.stat { display: flex; align-items: baseline; gap: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stat b { font-size: 18px; color: var(--fg); font-family: var(--font-display); font-weight: 600; }
.stat.grow { flex: 1 1 220px; flex-wrap: wrap; }
.stat.grow .bar { flex: 1 1 100%; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--used-bg); border: 1px solid var(--line); }
.seg button { min-height: 42px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; font-weight: 600; font-size: 14.5px; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.playout { display: grid; gap: 16px; }
.pside { padding: 0; overflow: hidden; }
.tools { padding: 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.plist, .blist { padding: 6px; display: grid; gap: 2px; align-content: start; min-height: 0; }
.prow {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  width: 100%; min-height: 46px; padding: 8px 10px; text-align: left; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 10px;
}
.prow:hover { background: var(--bg); }
.prow.current { background: var(--accent-soft); border-color: var(--accent); }
.prow .num { font-family: var(--font-mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.prow .pname { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.prow.done .pname { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--used-fg); }
.prow.current .badge { background: var(--surface); }

.pmain { border: 1.5px solid var(--accent); display: grid; gap: 14px; align-content: start; }
.mhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.mhead .left, .mhead .right { display: flex; align-items: baseline; gap: 10px; }
.eyebrow { font-size: 12px; letter-spacing: .09em; text-transform: uppercase; font-weight: 600; color: var(--accent); }
.pos { font-family: var(--font-mono); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.reset { background: none; border: 0; border-radius: 6px; padding: 4px 6px; cursor: pointer; font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.reset:hover { color: var(--fg); }
.frows { display: grid; gap: 8px; }
.frow {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px;
  width: 100%; min-height: 66px; padding: 10px 12px 10px 14px; text-align: left; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, background .15s;
}
.frow:hover { border-color: var(--accent); }
.frow .k { grid-column: 1; }
.frow .t { grid-column: 1; font-size: 20px; font-weight: 600; overflow-wrap: anywhere; min-width: 0; line-height: 1.25; }
.frow .t.mono { font-family: var(--font-mono); font-size: 15.5px; font-weight: 500; }
.frow .pill { grid-column: 2; grid-row: 1 / span 2; min-width: 78px; text-align: center; font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 99px; background: var(--accent); color: var(--on-accent); }
.frow.used { background: var(--used-bg); }
.frow.used .t { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--used-fg); }
.frow.used .pill { background: transparent; color: var(--used-fg); box-shadow: inset 0 0 0 1px var(--line); }
.frow.flash { border-color: var(--ok); }
.frow.flash .pill { background: var(--ok); color: var(--on-accent); box-shadow: none; }
.phead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 2px; }
.fphones { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.fphone {
  display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 50px; padding: 8px 12px; text-align: left; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; transition: border-color .15s, background .15s;
}
.fphone:hover { border-color: var(--accent); }
.fphone .n { flex: none; min-width: 1.6em; font-size: 11px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.fphone .t { min-width: 0; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 15.5px; font-variant-numeric: tabular-nums; }
.fphone.next { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.fphone.next .n { color: var(--accent); }
.fphone.used { background: var(--used-bg); }
.fphone.used .t { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--used-fg); }
.fphone.flash { border-color: var(--ok); background: var(--accent-soft); box-shadow: none; }
.shipped { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13.5px; color: var(--muted); }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 99px; padding: 4px 10px; font-size: 13px; cursor: pointer; color: var(--fg); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.donebox { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; }
.pactions { display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 8px; }
.pactions .sm { display: none; }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); font-weight: 400; }

@media (min-width: 900px) {
  .ptabs { display: none; }
  .playout { grid-template-columns: 340px minmax(0, 1fr); align-items: start; }
  .pside { position: sticky; top: 84px; max-height: calc(100vh - 100px); display: flex; flex-direction: column; }
  .plist { overflow-y: auto; flex: 1; }
}
@media (max-width: 899px) {
  .playout[data-ptab="list"] .pmain, .playout[data-ptab="current"] .pside { display: none; }
  #tab-people:not([hidden]) ~ .foot { padding-bottom: 96px; }
  .pmain { padding: 14px; }
  .pactions {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--line); grid-template-columns: 1fr 1.8fr 1fr;
  }
  .pactions .lg { display: none; }
  .pactions .sm { display: inline; }
  .pmain .hint { display: none; }
}

/* ---------- ship ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: flex-end; }
.field { display: grid; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field .hint { display: inline; }
#perShipper { width: 120px; }
.ta-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 0 8px; }
.ta-title { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.imgdrop {
  border: 1.5px dashed var(--line); border-radius: 10px; padding: 8px 14px; font-size: 13px; color: var(--muted); cursor: pointer;
}
.imgdrop:hover, .imgdrop.drag { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-title { font-family: var(--font-display); font-weight: 600; font-size: 19px; }
.toolbar-sub { font-size: 13px; color: var(--muted); margin-top: 2px; max-width: 70ch; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.saved-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 600; }

.table-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--line); border-radius: 10px; -webkit-overflow-scrolling: touch; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; white-space: nowrap; }
table.grid thead th {
  position: sticky; top: 0; z-index: 1; text-align: left; padding: 9px 10px; background: var(--used-bg); color: var(--muted);
  font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line);
}
table.grid tbody td { padding: 5px 7px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tbody tr:hover { background: var(--bg); }
table.grid td.num { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 12px; padding-right: 10px; }
table.sheet tr.ship-sep td { border-top: 2px solid var(--accent); }
.cell { min-width: 56px; padding: 4px 6px; border-radius: 6px; outline: none; border: 1px solid transparent; }
.cell:hover { border-color: var(--line); background: var(--surface); }
.cell:focus { border-color: var(--accent); background: var(--surface); }
.cell.mono { font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.cell.dim { min-width: 38px; text-align: center; font-family: var(--font-mono); font-size: 13px; }
.cell.name { font-weight: 600; }
.fromcell { background: var(--from-bg); border-radius: 8px; padding: 4px; min-width: 210px; }
.fromcell .cell { padding: 2px 6px; }
.from-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 2px 6px 0; }
.inline-cells { display: flex; gap: 2px; }
.row-del { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; padding: 4px 8px; border-radius: 6px; }
.row-del:hover { color: var(--danger); background: var(--used-bg); }

/* ---------- track ---------- */
.tlayout { display: grid; gap: 16px; }
@media (min-width: 980px) {
  .tlayout { grid-template-columns: 320px minmax(0, 1fr); align-items: start; }
  .tside { position: sticky; top: 84px; max-height: calc(100vh - 100px); display: flex; flex-direction: column; }
  .blist { overflow-y: auto; flex: 1; }
}
@media (max-width: 979px) { .blist { max-height: 300px; overflow-y: auto; } }
.tside { display: grid; gap: 6px; padding: 12px; }
.brow {
  display: grid; gap: 6px; width: 100%; text-align: left; cursor: pointer; padding: 10px 12px;
  background: transparent; border: 1px solid transparent; border-radius: 10px;
}
.brow:hover { background: var(--bg); }
.brow.current { background: var(--accent-soft); border-color: var(--accent); }
.brow .bt { font-weight: 600; overflow-wrap: anywhere; }
.brow .bm { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.brow .bar i { background: var(--ok); }
.hit { display: grid; gap: 2px; width: 100%; text-align: left; cursor: pointer; padding: 8px 12px; border: 1px solid transparent; border-radius: 10px; background: transparent; }
.hit:hover { background: var(--bg); border-color: var(--line); }
.hit .ht { font-weight: 600; overflow-wrap: anywhere; }
.hit .hm { font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); overflow-wrap: anywhere; }
.empty-state { text-align: center; padding: 36px 12px; display: grid; gap: 10px; justify-items: center; }
.empty-state h2 { font-family: var(--font-display); font-weight: 600; font-size: 20px; margin: 0; }
.empty-state p { margin: 0; color: var(--muted); max-width: 52ch; }
#batchView { display: grid; gap: 14px; }
.bhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.bname { font-family: var(--font-display); font-weight: 600; font-size: 20px; background: transparent; border-color: transparent; padding: 0 6px; margin-left: -6px; width: min(100%, 420px); }
.bname:hover { border-color: var(--line); }
.bname:focus { background: var(--bg); border-color: var(--accent); outline: none; }
.bstats { display: flex; gap: 8px; flex-wrap: wrap; }
.bactions { display: flex; flex-wrap: wrap; gap: 8px; }
.drop {
  border: 1.5px dashed var(--line); border-radius: 12px; padding: 14px; text-align: center; font-size: 13.5px; color: var(--muted);
}
.drop.drag { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.panel { display: grid; gap: 8px; padding: 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.panel .btn-row { margin-top: 0; }
.panel textarea { min-height: 120px; background: var(--surface); }
.progress { display: grid; gap: 6px; font-size: 13.5px; color: var(--muted); }
.note-box { padding: 12px 14px; border-radius: 10px; background: var(--ok-soft); font-size: 14px; }
.note-box.warn { background: var(--accent-soft); }
.links { display: grid; gap: 8px; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
.links p { margin: 0; font-size: 13.5px; color: var(--muted); }
.links .lrow { display: flex; flex-wrap: wrap; gap: 8px; }
.links a { text-decoration: none; }
.unmatched { display: grid; gap: 10px; }
.unmatched h3 { margin: 0; font-size: 15px; }
.urow { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); align-items: center; }
.urow img { width: 72px; height: 72px; object-fit: contain; background: #fff; border-radius: 6px; border: 1px solid var(--line); }
.urow .ubody { display: grid; gap: 6px; min-width: 0; }
.urow .uname { font-weight: 600; overflow-wrap: anywhere; }
.urow .utrack { font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; }
.urow .uact { display: flex; flex-wrap: wrap; gap: 6px; }
.urow select { min-height: 38px; font-size: 14px; max-width: 100%; }
.urow .btn { min-height: 38px; }
table.track td { white-space: normal; }
table.track .who { display: grid; min-width: 120px; }
table.track .who b { font-weight: 600; }
table.track .who span { font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); }
table.track .who span.plain { font-family: var(--font-body); }
table.track .pkg { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.tin { font-family: var(--font-mono); font-size: 13.5px; min-height: 38px; width: 196px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.tin:focus { border-color: var(--accent); outline: none; background: var(--surface); }
.carrier { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; background: var(--used-bg); color: var(--muted); margin-right: 6px; }
.tlink { color: var(--accent); font-weight: 600; text-decoration: none; white-space: nowrap; }
.tlink:hover { text-decoration: underline; }
.src { font-size: 11.5px; color: var(--muted); display: block; margin-top: 2px; }
.src.warn { color: var(--warn); }
tr.delivered td { color: var(--muted); }
tr.delivered .who b { text-decoration: line-through; text-decoration-thickness: 1.5px; }
tr.flash td { background: var(--accent-soft); }
td.center { text-align: center; }
.mlabel { display: none; }

/* Phones: each tracking row becomes a card instead of a wide table. */
@media (max-width: 700px) {
  .table-wrap.cards { max-height: none; overflow: visible; border: 0; border-radius: 0; }
  table.track thead { display: none; }
  table.track, table.track tbody { display: block; }
  table.track tbody tr {
    display: grid; grid-template-columns: 26px minmax(0, 1fr) auto;
    grid-template-areas: "sel recv dlv" "sel ship ship" "sel pkg pkg" ". trk trk" ". link link";
    gap: 6px 10px; padding: 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  }
  table.track tbody tr.flash { background: var(--accent-soft); }
  table.track tbody td { display: block; padding: 0; border: 0; background: transparent !important; }
  table.track td:nth-child(1) { grid-area: sel; padding-top: 2px; }
  table.track td:nth-child(2) { display: none; }
  table.track td:nth-child(3) { grid-area: ship; }
  table.track td:nth-child(4) { grid-area: recv; }
  table.track td:nth-child(5) { grid-area: pkg; }
  table.track td:nth-child(6) { grid-area: trk; }
  table.track td:nth-child(7) { grid-area: link; }
  table.track td:nth-child(8) { grid-area: dlv; }
  table.track td:nth-child(8) label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
  table.track .who { min-width: 0; }
  table.track td:nth-child(3) .who { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; }
  table.track td:nth-child(3) .who b { font-weight: 500; font-size: 13.5px; }
  table.track td:nth-child(4) .who b { font-size: 16px; }
  .mlabel { display: inline; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
  .tin { width: 100%; font-size: 16px; min-height: 44px; }
}

/* ---------- footer, toast ---------- */
.foot { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: center; font-size: 13px; color: var(--muted); padding: 24px 0 8px; }
.foot .confirm { flex: 1 1 100%; max-width: 560px; }
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); overflow-wrap: anywhere; z-index: 30;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 899px) { body.on-people .toast { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
