:root {
  --bg: #f4f6f8; --card: #ffffff; --ink: #18222d; --muted: #566270; --line: #d5dce3;
  --primary: #1b5e8c; --primary-ink: #ffffff; --danger: #b3261e; --ok: #17692f; --warn: #8a4f00;
  --st-new-bg: #dfeaf6; --st-new-fg: #123f66;
  --st-packing-bg: #fcebc2; --st-packing-fg: #6b4000;
  --st-packed-bg: #d3eeeb; --st-packed-fg: #0a4f49;
  --st-shipped-bg: #e4e0f7; --st-shipped-fg: #36297e;
  --st-delivered-bg: #d6f0de; --st-delivered-fg: #11562a;
  --st-cancelled-bg: #e6e6e6; --st-cancelled-fg: #4a4a4a;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 18px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-wrap: anywhere; overflow-x: hidden;
}
#app { min-height: 100vh; display: flex; flex-direction: column; }
.loading { padding: 32px 16px; color: var(--muted); }
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
header.top .brand { font-weight: 700; font-size: 19px; }
header.top .who { font-size: 14px; color: var(--muted); text-align: right; min-width: 0; display: flex; align-items: center; gap: 8px; }
main { flex: 1; padding: 14px 16px 96px; width: 100%; max-width: 640px; margin: 0 auto; }
h1 { font-size: 24px; margin: 4px 0 14px; }
h2 { font-size: 19px; margin: 22px 0 8px; }
p { margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
nav.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex;
  background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.bottom a {
  flex: 1; min-height: 60px; display: flex; align-items: center; justify-content: center;
  text-align: center; text-decoration: none; color: var(--ink); font-size: 15px; font-weight: 600;
  padding: 4px 2px;
}
nav.bottom a.current { color: var(--primary); box-shadow: inset 0 3px 0 var(--primary); }
nav.bottom a.walkin { background: #fff4d6; color: #5c3b00; }
nav.bottom a.walkin.current { box-shadow: inset 0 3px 0 #b87400; }
.btn, button, .btnlink {
  font: inherit; font-weight: 600; min-height: 56px; padding: 12px 18px; border-radius: var(--radius);
  border: 2px solid var(--primary); background: #fff; color: var(--primary); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  text-decoration: none; touch-action: manipulation;
}
header.top button { min-height: 40px; padding: 6px 12px; font-size: 15px; }
button.primary, .btnlink.primary { background: var(--primary); color: var(--primary-ink); }
button.danger, .btnlink.danger { border-color: var(--danger); color: var(--danger); }
button.danger.solid { background: var(--danger); color: #fff; }
button.big, .btnlink.big { width: 100%; min-height: 64px; font-size: 20px; }
button.walkin-cta, .btnlink.walkin-cta { background: #f2a900; border-color: #b87400; color: #2b1c00; width: 100%; min-height: 72px; font-size: 22px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button[aria-busy="true"] { opacity: .7; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.card {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin: 0 0 12px; color: inherit; text-decoration: none; position: relative;
  border-left-width: 8px;
}
.card.s-new { border-left-color: #4a86bd; } .card.s-packing { border-left-color: #e0a000; }
.card.s-packed { border-left-color: #2a9c93; } .card.s-shipped { border-left-color: #6a58c9; }
.card.s-delivered { border-left-color: #2f9e57; } .card.s-cancelled { border-left-color: #999; opacity: .85; }
.card .t1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card .no { font-weight: 800; font-size: 20px; }
.card .cust { font-size: 19px; margin-top: 4px; }
.card .meta { color: var(--muted); font-size: 15px; margin-top: 4px; }
.pill {
  display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: 14px;
  letter-spacing: .04em; white-space: nowrap;
}
.pill.new { background: var(--st-new-bg); color: var(--st-new-fg); }
.pill.packing { background: var(--st-packing-bg); color: var(--st-packing-fg); }
.pill.packed { background: var(--st-packed-bg); color: var(--st-packed-fg); }
.pill.shipped { background: var(--st-shipped-bg); color: var(--st-shipped-fg); }
.pill.delivered { background: var(--st-delivered-bg); color: var(--st-delivered-fg); }
.pill.cancelled { background: var(--st-cancelled-bg); color: var(--st-cancelled-fg); }
.pill.big { font-size: 18px; padding: 8px 18px; }
.badge { display: inline-block; margin: 6px 6px 0 0; padding: 3px 10px; border-radius: 8px; font-size: 14px; font-weight: 700; }
.badge.warn { background: #fff0cf; color: var(--warn); border: 1px solid #e3b556; }
.badge.red { background: #fde4e1; color: var(--danger); border: 1px solid #e59a93; }
.badge.info { background: #e8eef4; color: #26425c; border: 1px solid #b9c8d6; }
.tabs { display: flex; gap: 6px; margin: 10px 0; }
.tabs button { flex: 1; min-height: 52px; padding: 8px; }
.tabs button[aria-selected="true"] { background: var(--primary); color: #fff; }
.f { display: block; margin: 14px 0 0; font-weight: 600; }
.f .hint { font-weight: 400; color: var(--muted); font-size: 15px; }
input, select, textarea {
  font: inherit; width: 100%; min-height: 54px; padding: 10px 12px; margin-top: 6px;
  border: 2px solid #aab5c0; border-radius: 12px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #f2a900; outline-offset: 2px; }
textarea { min-height: 84px; }
.seg { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.seg label { flex: 1 1 90px; margin: 0; position: relative; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; margin: 0; }
.seg span {
  display: flex; align-items: center; justify-content: center; min-height: 54px; padding: 8px;
  border: 2px solid #aab5c0; border-radius: 12px; background: #fff; font-weight: 700; text-align: center;
}
.seg input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid #f2a900; outline-offset: 2px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 12px; }
.panel.sub { background: #f8fafb; margin-top: 10px; }
.alert { padding: 12px 14px; border-radius: 12px; margin: 12px 0; font-weight: 600; }
.alert.error { background: #fde4e1; color: #7f1710; border: 1px solid #e59a93; }
.alert.ok { background: #dcf2e3; color: #11562a; border: 1px solid #8fcca5; }
.alert.info { background: #e6eff7; color: #17415f; border: 1px solid #b2cbe0; }
.alert.warn { background: #fff0cf; color: #6b4000; border: 1px solid #e3b556; }
dl.kv { margin: 0; display: grid; grid-template-columns: minmax(0, 40%) minmax(0, 60%); gap: 6px 10px; }
dl.kv dt { color: var(--muted); font-size: 16px; } dl.kv dd { margin: 0; font-weight: 600; }
.line { padding: 10px 0; border-top: 1px solid var(--line); }
.line:first-child { border-top: 0; }
.line .p { font-weight: 700; }
.batch { margin: 4px 0 0 10px; font-size: 16px; color: #2c3946; }
.short { color: var(--danger); font-weight: 800; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { padding: 6px 0 6px 18px; position: relative; border-left: 3px solid #b9c4cf; margin-left: 6px; }
.tl li::before { content: ""; position: absolute; left: -8px; top: 12px; width: 13px; height: 13px; border-radius: 50%; background: #1b5e8c; }
.tl .when { color: var(--muted); font-size: 15px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin-top: 8px; }
.photos a { display: block; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #eee; }
.photos img { display: block; width: 100%; height: 104px; object-fit: cover; }
.filebtn { position: relative; overflow: hidden; }
.filebtn input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; min-height: 0; margin: 0; cursor: pointer; }
.sheet-bg { position: fixed; inset: 0; background: rgba(10, 20, 30, .55); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 640px; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet h3 { margin: 0 0 8px; font-size: 21px; }
.batchrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: end; padding: 8px; border: 1px dashed #aab5c0; border-radius: 12px; margin-top: 8px; }
.batchrow .full { grid-column: 1 / -1; }
.batchrow input { margin-top: 2px; }
.batchrow small { color: var(--muted); }
.cust-list { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; margin-top: 6px; background: #fff; }
.cust-list button { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; justify-content: flex-start; text-align: left; min-height: 52px; color: var(--ink); font-weight: 500; }
.chosen { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: #e6eff7; border-radius: 12px; margin-top: 6px; font-weight: 700; }
.chosen button { min-height: 44px; padding: 4px 12px; }
.login { max-width: 420px; margin: 0 auto; padding: 48px 20px; text-align: center; }
.login h1 { font-size: 28px; }
.sumlist { margin: 6px 0 0; padding-left: 22px; }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.linkrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 0; border-top: 1px solid var(--line); }
.linkrow:first-child { border-top: 0; }
.wide { width: 100%; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.big-amt { font-size: 24px; margin: 6px 0; }
#search { margin-bottom: 14px; }
a.no { color: inherit; text-decoration: none; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.plain:disabled input, fieldset.plain:disabled textarea, fieldset.plain:disabled select { background: #eceff2; color: #4b5560; }
.photos a.thumb { display: block; min-height: 104px; }
.thumb-ph { display: flex; align-items: center; justify-content: center; min-height: 104px; padding: 8px; text-align: center; font-size: 14px; color: var(--muted); background: #eceff2; }
.thumb-ph.failed { color: var(--danger); font-weight: 600; }
.photos a.thumb, .photos a.thumb:hover { text-decoration: none; }
.thumb-ph, .thumb-ph.failed { text-decoration: none; }
