:root {
  --ink: #17151d;
  --muted: #96939e;
  --light: #f7f6fb;
  --line: #efedf4;
  --accent: #ff2442;
  --blue: #1597eb;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #f3f1f7; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--ink); }
body { overscroll-behavior-y: none; }
button { border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
/* Only the order feed scrolls; the header and tabs remain outside it. */
.phone-shell { width: min(100%, 520px); height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; margin: 0 auto; background: #fff; padding-top: env(safe-area-inset-top); }
.topbar { flex: 0 0 60px; height: 60px; display: flex; align-items: center; gap: 8px; padding: 7px 14px 5px 14px; position: relative; z-index: 5; background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
.icon-btn.back { font-size: 37px; font-weight: 200; line-height: 1; width: 28px; transform: translateY(-2px); }
.search-pill { height: 39px; flex: 1; border-radius: 22px; background: #f5f4f8; color: #b8b5be; display: flex; align-items: center; padding: 0 12px; gap: 5px; font-size: 16px; white-space: nowrap; overflow: hidden; }
.search-icon { font-size: 26px; line-height: 0; color: #b3b0ba; transform: rotate(-20deg); }
.package { width: 29px; position: relative; font-size: 27px; line-height: 20px; }
.package small { display: block; font-size: 10px; line-height: 10px; margin-top: 4px; }
.grid-btn { width: 27px; height: 30px; display: grid; grid-template-columns: repeat(2, 8px); grid-template-rows: repeat(2, 8px); gap: 3px; place-content: center; }
.grid-btn i { display: block; width: 8px; height: 8px; border: 2px solid var(--ink); border-radius: 2px; }
.tabs { flex: 0 0 52px; display: flex; align-items: center; height: 52px; padding: 0 13px; gap: 25px; overflow-x: auto; white-space: nowrap; border-bottom: 1px solid #faf9fb; scrollbar-width: none; position: relative; z-index: 4; background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; flex: 0 0 auto; font-size: 16px; color: #6f6c76; padding: 15px 0; }
.tab.active { color: var(--ink); font-weight: 600; }
.tab.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 5px; height: 2px; background: var(--accent); border-radius: 3px; }
.tab b { position: absolute; top: 4px; right: -14px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; display: inline-grid; place-items: center; font-weight: 600; }
.filter-btn { flex: 0 0 auto; font-size: 21px; color: #77747f; transform: rotate(180deg); }
.order-feed { flex: 1 1 0; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; touch-action: pan-y; background: #f7f6fb; padding: 8px 9px calc(24px + env(safe-area-inset-bottom)); }
.order-card { background: #fff; border-radius: 16px; margin-bottom: 10px; overflow: hidden; box-shadow: 0 1px 0 rgba(30,20,50,.015); }
.shop-row { height: 47px; display: flex; align-items: center; padding: 0 14px; gap: 5px; font-size: 16px; }
.shop-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-tag { background: #1e1a21; color: #fff; border-radius: 3px; padding: 2px 4px; font-size: 10px; line-height: 14px; }
.live-tag { background: var(--accent); color: white; border-radius: 3px; padding: 2px 5px; font-size: 10px; }
/* Scale with the adjacent shop-name font. GIF padding is included, so a
   1.5em image height makes the visible lettering close to the shop-name size. */
.shop-badges { position: relative; display: inline-flex; flex: 0 0 auto; align-items: center; gap: 5px; width: 7.55em; height: 1.5em; }
.shop-badges > .shop-tag, .shop-badges > .live-tag { visibility: hidden; }
.shop-badges-image { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }

.chevron { color: #aaa7b0; font-size: 20px; margin-left: -2px; }
.order-status { margin-left: auto; color: var(--accent); font-size: 16px; }
.product-row { display: flex; padding: 4px 14px 7px; gap: 13px; align-items: flex-start; }
.product-art { flex: 0 0 96px; height: 96px; background: #faf9fc; border-radius: 10px; display: grid; place-items: center; overflow: hidden; }
.phone-art { width: 71px; height: 61px; border-radius: 7px 7px 9px 9px; transform: rotate(-4deg); position: relative; box-shadow: 8px 8px 0 -3px #d8d6dd; background: linear-gradient(145deg,#2d3444,#0c1220 60%,#5b6683); }
.phone-art::before { content: ""; position: absolute; inset: 4px; border-radius: 5px; background: radial-gradient(circle at 65% 22%, #a2b3d1 0 6%, transparent 7%), linear-gradient(135deg,#20304a 0%,#111421 42%,#34445d 100%); }
.phone-art.light { background: linear-gradient(145deg,#e5e8ee,#8e959f); box-shadow: 8px 8px 0 -3px #d9d8df; }
.phone-art.light::before { background: radial-gradient(circle at 68% 25%, #f5dfb0 0 7%, transparent 8%), linear-gradient(135deg,#c8d4de,#f1dfbc 52%,#b7c1c9); }
.phone-art.pro { background: linear-gradient(145deg,#22252d,#06070a 60%,#666875); }
.phone-art.pro::before { background: radial-gradient(circle at 64% 23%, #9b9ca3 0 6%, transparent 7%), linear-gradient(135deg,#44464f,#111217 42%,#26272e); }
.product-info { flex: 1; min-width: 0; }
.product-title-line { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.product-title { font-size: 16px; font-weight: 650; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.price { font-size: 16px; font-weight: 700; white-space: nowrap; }
.spec { color: #9b98a1; font-size: 14px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qty { float: right; color: #9996a0; font-size: 13px; font-weight: 400; }
.return-label { display: inline-block; margin-top: 5px; padding: 2px 4px; color: var(--blue); border: 1px solid #bce4fb; border-radius: 3px; font-size: 11px; line-height: 14px; background: #f5fbff; }
.pay-line { text-align: right; margin-top: 10px; font-size: 14px; white-space: nowrap; }
.pay-line strong { font-size: 20px; margin-left: 2px; }
.ship-row { margin: 0 14px; height: 39px; background: #f7f6fa; border-radius: 10px; display: flex; align-items: center; padding: 0 12px; font-size: 14px; }
.ship-row strong { font-weight: 600; margin-right: 9px; }
.ship-row span { color: #77747d; }
.ship-row .arrow { margin-left: auto; color: #aaa7b0; font-size: 21px; }
.actions { display: flex; align-items: center; height: 60px; padding: 0 14px; gap: 9px; }
.more { color: #9d9aa4; font-size: 14px; margin-right: auto; }
.action-btn { min-width: 89px; height: 38px; padding: 0 15px; border-radius: 20px; background: #f8f7fa; font-size: 15px; white-space: nowrap; }
.action-btn.primary { color: var(--ink); }
.action-btn:active { transform: scale(.96); background: #efedf3; }
.completed { padding: 13px 14px 16px; background: linear-gradient(180deg,#fff 0,#fff6f8 100%); }
.completed .from { color: #88848f; font-size: 12px; margin-bottom: 13px; }
.completed .from::before { content: "◉"; color: var(--accent); margin-right: 6px; }
.completed .summary { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-weight: 650; font-size: 16px; }
.completed .summary span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast { position: fixed; left: 50%; bottom: calc(30px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: rgba(25,23,30,.88); color: #fff; border-radius: 22px; padding: 10px 17px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .22s ease; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 700px) { body { padding: 24px 0; } .phone-shell { height: calc(100vh - 48px); height: calc(100dvh - 48px); border-radius: 26px; box-shadow: 0 12px 45px rgba(20,15,35,.15); } }

/* Per-order editing; the header and tabs stay outside the scrollable feed. */
.product-art img { width: 100%; height: 100%; display: block; object-fit: cover; }
.edit-order { flex: 0 0 auto; padding: 10px 0; min-width: 34px; margin-right: auto; color: #77727f; font-size: 14px; }
/* Hide only the label; preserve its layout and the original clickable button. */
.edit-order .edit-label { visibility: hidden; }
.edit-order:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.actions .action-btn { min-width: 0; padding: 0 12px; font-size: 14px; }
.shop-name { min-width: 0; }
.shop-tag, .live-tag { flex-shrink: 0; white-space: nowrap; }
.order-status { flex-shrink: 0; max-width: 34%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ship-row { min-height: 39px; height: auto; padding-top: 9px; padding-bottom: 9px; gap: 8px; }
.ship-row strong { flex-shrink: 0; max-width: 40%; overflow-wrap: anywhere; margin-right: 0; }
.ship-text { min-width: 0; overflow-wrap: anywhere; }
.completed-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.completed-heading .from { margin-bottom: 0; min-width: 0; overflow-wrap: anywhere; }
.completed-heading .edit-order { margin-right: 0; }
.completed-product { display: flex; align-items: center; gap: 12px; margin: 5px 0 13px; }
.completed-product .product-art { flex-basis: 64px; height: 64px; }
.completed .ship-row { margin: 0; }
.completed .summary span:last-child { flex-shrink: 0; }
.toast { max-width: calc(100% - 32px); width: max-content; text-align: center; z-index: 30; }
.editor { border: 0; padding: 0; width: min(100%, 520px); max-width: 100%; max-height: 90vh; max-height: 90dvh; margin: auto auto 0; border-radius: 22px 22px 0 0; color: var(--ink); background: white; box-shadow: 0 -8px 45px #0002; overflow: hidden; }
.editor::backdrop { background: rgba(15, 12, 22, .45); }
.editor form { display: flex; flex-direction: column; max-height: 90vh; max-height: 90dvh; }
.editor-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 14px; flex-shrink: 0; border-bottom: 1px solid var(--line); }
.editor-header h1 { font-size: 20px; margin: 0 0 5px; }
.editor-header p { font-size: 12px; color: #8d8793; margin: 0; }
.close-editor { width: 44px; height: 44px; font-size: 30px; color: #87818d; }
.editor-body { flex: 1 1 auto; min-height: 0; padding: 18px 20px 8px; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
.image-editor { display: flex; gap: 16px; align-items: center; padding-bottom: 22px; }
.image-preview { flex: 0 0 96px; }
.image-preview .product-art { width: 96px; }
.image-controls { min-width: 0; }
.upload-button { display: inline-block; border-radius: 18px; padding: 10px 15px; background: #fff0f3; color: #e52a49; font-size: 14px; font-weight: 600; cursor: pointer; }
#editImage { display: block; width: 100%; max-width: 190px; font-size: 12px; margin-top: 8px; }
#resetImage { display: block; padding: 10px 0 3px; font-size: 13px; color: #77717f; }
.image-controls p { color: #9b94a2; font-size: 11px; line-height: 1.5; margin: 7px 0 0; }
.field { display: block; font-size: 13px; font-weight: 600; margin-bottom: 18px; }
.field input { display: block; width: 100%; border: 1px solid #e9e5ed; border-radius: 11px; padding: 12px; margin-top: 8px; font: inherit; font-size: 16px; font-weight: 400; color: var(--ink); background: #faf9fc; }
.field input:focus { outline: 2px solid #ff9aab; outline-offset: 1px; background: #fff; }
.field small { display: block; font-size: 11px; font-weight: 400; line-height: 1.6; color: #99919f; margin-top: 7px; }
.editor-error { font-size: 13px; color: #c42440; line-height: 1.6; background: #fff0f3; padding: 12px; border-radius: 10px; }
.editor-footer { display: flex; gap: 12px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); flex-shrink: 0; }
.editor-footer button { height: 46px; flex: 1; border-radius: 23px; font-size: 16px; font-weight: 600; background: #f3f1f6; }
.editor-footer .save-editor { flex: 2; background: var(--accent); color: white; }
.editor-footer .save-editor:disabled { opacity: .5; cursor: wait; }
button:focus-visible, .upload-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 370px) {
  .actions { gap: 5px; padding: 0 12px; }
  .actions .action-btn { padding: 0 10px; font-size: 12px; }
  .product-row { gap: 9px; padding-left: 12px; padding-right: 12px; }
  .product-art { flex-basis: 78px; height: 78px; }
  .product-title, .price { font-size: 14px; }
  .pay-line { font-size: 12px; }
  .pay-line strong { font-size: 17px; }
  .shop-row { padding: 0 12px; font-size: 14px; }
  .shop-tag, .live-tag { font-size: 9px; }
  .order-status { font-size: 14px; }
  .image-preview .product-art { height: 96px; }
}
/* Custom text may be longer than the sample copy. */
.pay-line { white-space: normal; overflow-wrap: anywhere; }
.pay-line strong { display: inline-block; white-space: nowrap; }

/* Installed PWA occupies its window without a web-authored fullscreen toolbar. */
.phone-shell { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
html.installed-app body { padding: 0; background: #fff; }
html.installed-app .phone-shell { width: 100%; height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none; }
@media (display-mode: standalone), (display-mode: fullscreen) {
  body { padding: 0; background: #fff; }
  .phone-shell { width: 100%; height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none; }
}
.install-dialog { color: var(--ink); border: 0; padding: 0; width: min(440px, calc(100% - 28px)); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); border-radius: 22px; overflow-y: auto; overscroll-behavior: contain; background: #fff; }
.install-dialog::backdrop { background: #100c1866; }
.guide-header { display: flex; align-items: center; gap: 12px; padding: 22px 20px 14px; }
.guide-header img { flex: 0 0 52px; border-radius: 13px; }
.guide-header h2 { margin: 0 0 5px; font-size: 19px; }
.guide-header p { color: #8d8793; font-size: 12px; margin: 0; }
.guide-close { flex: 0 0 36px; height: 40px; margin-left: auto; color: #87818d; font-size: 28px; }
.guide-body { padding: 0 22px; line-height: 1.75; font-size: 14px; }
.guide-body ol { padding-left: 23px; }
.guide-body li { padding: 5px 0; }
.guide-note { font-size: 12px; color: #8d8793; }
.offline-status { padding: 11px 13px; background: #f6f4f8; border-radius: 10px; font-size: 12px; color: #696270; }
.guide-footer { padding: 8px 22px 22px; }
.guide-footer button, #installApp { border-radius: 24px; padding: 13px 18px; background: var(--accent); color: white; width: 100%; font-size: 15px; font-weight: 600; }
#installApp[hidden], #installSteps[hidden] { display: none; }
