/* ---------- Fulfillment ---------- */
.group-card .card-head {
  align-items: center;
}
.recipient {
  display: grid;
  gap: 2px;
}
.recipient strong {
  font-size: 15px;
  font-weight: 600;
}
.recipient span {
  color: var(--text-2);
  font-size: 13px;
}
.head-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pick-list {
  display: grid;
  margin: -8px 0;
}
.pick-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.pick-list label:last-child {
  border-bottom: 0;
}
.pick-list .qty {
  margin-left: auto;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
/* A pick row carries the item's checkbox label plus its shortage control. */
.pick-list .pick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.pick-list .pick-row:last-child {
  border-bottom: 0;
}
.pick-list .pick-row label {
  flex: 1;
  min-width: 220px;
  padding: 0;
  border-bottom: 0;
}
.pick-list .pick-row > .cell-stack {
  flex: 1;
  min-width: 220px;
}
.shortage-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}
/* A game prize's own actions (undo a convert, hold, exchange, ship): in 窗口内's rows beside the shortage control, and in
   the last cell of 查用户's cabinet. */
.prize-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
/* Same-tier targets for a shortage item, opened under its row. */
.exchange-picker {
  flex-basis: 100%;
  display: grid;
  gap: 8px;
  justify-items: start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.exchange-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.exchange-options .cell-sub {
  margin-left: 4px;
}
.pack-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.pack-form .field {
  width: 220px;
}

/* ---------- Parcels ---------- */
.parcel .card-head {
  align-items: center;
}
.parcel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.parcel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 20px 32px;
}
.kv {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
  font-size: 13px;
}
.kv dt {
  color: var(--text-3);
}
.kv dd {
  margin: 0;
  min-width: 0;
}
.items {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
}
.items li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.items li:last-child {
  border-bottom: 0;
}
.items .qty {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 4px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.stepper li {
  position: relative;
  display: grid;
  gap: 2px;
  padding-top: 30px;
  font-size: 12px;
  color: var(--text-3);
  counter-increment: step;
}
.stepper li::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  color: var(--text-3);
}
.stepper li::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 26px;
  right: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--border);
}
.stepper li:last-child::after {
  display: none;
}
.stepper li strong {
  font-weight: 500;
  color: var(--text-2);
  font-size: 13px;
}
.stepper li.done::before {
  content: "✓";
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.stepper li.done::after {
  background: var(--accent);
}
.stepper li.current::before {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 4px rgb(35 91 73 / 0.14);
}
.stepper li.current strong {
  color: var(--text);
  font-weight: 600;
}
.next-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.next-step .hint {
  font-size: 13px;
  color: var(--text-2);
}
.more-ops .form-actions {
  margin-top: 10px;
}
pre {
  margin: 8px 0 0;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-3);
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 330px;
  overflow: auto;
}
.result-panel {
  margin-bottom: 16px;
}

/* ---------- Aftersales ---------- */
.ticket {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr);
}
.ticket-main {
  padding: 20px;
  display: grid;
  gap: 14px;
  align-content: start;
}
.ticket-side {
  padding: 20px;
  border-left: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  /* The card is as tall as its left side (an opened 物流 can be long): keep the form's rows their own height. */
  align-content: start;
}
.ticket-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ticket-meta {
  display: flex;
  gap: 8px 14px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
  color: var(--text-3);
}
.quote {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}
.timeline li {
  position: relative;
  padding: 0 0 14px 20px;
  font-size: 13px;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline li::after {
  content: "";
  position: absolute;
  left: 6.5px;
  top: 16px;
  bottom: 0;
  width: 1px;
  background: var(--border-strong);
}
.timeline li:last-child::after {
  display: none;
}
.timeline small {
  display: block;
}
.section-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  margin-bottom: 8px;
}
/* A ticket's 物流: the shipment, the return and the return's form, set apart from each other. */
.logistics-body .section-label:not(:first-child),
.logistics-body > form {
  margin-top: 16px;
}

/* ---------- Toast ----------
   #notice-bar floats below the top bar wherever the operator has scrolled,
   and never covers the top bar's own controls (logout included). app.js's
   message() toggles its [hidden] and .error; #notice itself is the live
   region, the "点击关闭" hint is an aria-hidden sibling. */
#notice-bar {
  position: fixed;
  left: 50%;
  top: calc(var(--topbar) + 10px);
  z-index: var(--z-toast);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: min(640px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #1f2a25;
  color: #f1f5f2;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.2s ease-out;
}
#notice-bar.error {
  background: #fff5f4;
  color: #7d231a;
  border: 1px solid var(--danger-line);
  border-left: 3px solid var(--danger);
}
#notice {
  flex: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  cursor: pointer;
  border-radius: 4px;
}
#notice:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}
#notice-hint {
  flex: none;
  font-size: 12px;
  opacity: 0.6;
  white-space: nowrap;
}
#notice button {
  min-height: var(--control-h-sm);
  padding: 0 10px;
  font-size: 13px;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, -6px);
  }
}

/* ---------- Dialog ---------- */
dialog {
  width: calc(100% - 32px);
  max-width: 460px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog.wide {
  max-width: 860px;
}
dialog::backdrop {
  background: rgb(18 30 24 / 0.45);
  backdrop-filter: blur(2px);
}
dialog h2 {
  font-size: 17px;
}
#confirm-copy,
.dialog-lead {
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.65;
}
/* A confirmation's lines (送满赠's 跳过 line, 游玩机会's three): `\n` in its text starts a line. */
#confirm-copy {
  white-space: pre-line;
}
/* 填写运单号: the note that 其他快递 is not tracked, between the carrier and the number. */
#waybill-other-note {
  margin: 8px 0 4px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}
iframe {
  width: 100%;
  height: 55vh;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

/* ---------- Responsive ---------- */
/* These cards lay out by their own width, not the window's (spec 2026-10-06 §2.2): the same card is narrow beside the
   sidebar on a small laptop and wide on a large screen. */
:has(> .mengli),
:has(> .parcel-grid),
:has(> .ticket) {
  container-type: inline-size;
}
@container (max-width: 760px) {
  .mengli {
    grid-template-columns: 140px minmax(0, 1fr);
  }
  .mengli-photo {
    width: 140px;
    height: 140px;
  }
  .mengli .styles-field {
    grid-column: 1 / -1;
  }
  .parcel-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@container (max-width: 800px) {
  .ticket {
    grid-template-columns: minmax(0, 1fr);
  }
  .ticket-side {
    border-left: 0;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }
}
/* Without container queries (Chrome < 105, Safari < 16, older WeChat browsers) the cards go one column on a narrow
   window instead. */
@supports not (container-type: inline-size) {
  @media (max-width: 900px) {
    .mengli,
    .parcel-grid,
    .ticket {
      grid-template-columns: minmax(0, 1fr);
    }
    .ticket-side {
      border-left: 0;
      border-top: 1px solid var(--border);
      border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    }
  }
}
@media (max-width: 900px) {
  /* A phone or narrow window (spec 2026-10-06 §2.8): no sidebar; a one-line top bar and a bottom bar instead. */
  .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    display: none;
  }
  .topbar {
    padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
    gap: 10px;
    justify-content: flex-start;
  }
  .page-name,
  .me {
    display: flex;
  }
  .topbar-mark {
    display: grid;
  }
  .page-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--fs-md);
  }
  .env {
    flex: none;
  }
  .env .muted,
  .identity {
    display: none;
  }
  #content {
    padding: 16px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left));
  }
  .app:has(> .tabbar:not([hidden])) #content {
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }
  .page-head {
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
  }
  /* The top bar shows the tab's name; the heading stays for screen readers. */
  .page-head h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .page-intro {
    margin-top: 0;
  }
  .draftbar {
    top: calc(var(--topbar) + 6px);
  }
  .tabbar:not([hidden]) {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    position: fixed;
    inset: auto 0 0 0;
    z-index: var(--z-topbar);
    padding: 4px max(4px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    background: var(--surface-glass);
    backdrop-filter: saturate(1.4) blur(10px);
    border-top: 1px solid var(--border);
  }
  .tabbar button {
    flex-direction: column;
    gap: 2px;
    min-height: var(--control-h-lg);
    padding: 4px 0;
    background: transparent;
    border-color: transparent;
    color: var(--text-3);
    font-size: var(--fs-xs);
    font-weight: 500;
    box-shadow: none;
  }
  .tabbar button:hover:not(:disabled) {
    background: transparent;
    border-color: transparent;
    color: var(--text);
  }
  .tabbar button.active {
    color: var(--accent);
    font-weight: 600;
  }
  .tabbar svg {
    width: 22px;
    height: 22px;
  }
  .updates-strip {
    margin: 12px 16px 0;
  }
  /* Notices sit at the bottom, above the bottom bar when there is one (a partner has none). */
  #notice-bar {
    top: auto;
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
  body:has(.tabbar:not([hidden])) #notice-bar {
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
  /* The narrow top bar already names the tab. */
  #content.switching::before {
    content: none;
  }
  #content.switching::after {
    left: 16px;
    right: 16px;
    top: calc(var(--topbar) + 16px);
  }
  dialog.sheet {
    width: 100vw;
    max-width: 100vw;
    margin: auto 0 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}
/* A phone's keyboard: the bottom bar steps aside while a field has focus. */
@media (pointer: coarse) {
  .page-intro [data-guide] {
    min-height: var(--control-h-sm);
  }
  body:has(:is(input:not([type="checkbox"]):not([type="radio"]), textarea):focus) .tabbar {
    display: none;
  }
}
@media (max-width: 640px) {
  .mengli {
    grid-template-columns: minmax(0, 1fr);
  }
  .card-head,
  .card-body {
    padding: 14px 16px;
  }
  .stepper li strong {
    font-size: 12px;
  }
  .stepper li small {
    display: none;
  }
  .search {
    width: 100%;
  }
  .who .role-hint {
    display: none;
  }
  .draftbar-actions {
    width: 100%;
  }
  .draftbar-actions button {
    flex: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Page-specific helpers ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.grid-2 > form.card {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.grid-2 > form.card .card-body {
  flex: 1;
}
.card > .card-toolbar {
  margin: 0;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.card-head + .card-toolbar {
  border-top: 0;
}
.card > details.card-section {
  margin: 0;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.card > details.card-section[open] {
  padding-bottom: 20px;
}
.section-note {
  margin: 10px 0 14px;
  max-width: 80ch;
}
.head-pills.start {
  justify-content: flex-start;
}
.next-hint {
  font-size: 13px;
  color: var(--text-2);
}
.pack-field {
  width: 240px;
  max-width: 100%;
}
.result-panel {
  padding: 14px 20px;
}
.result-panel > summary {
  cursor: pointer;
  font-weight: 600;
}
td .empty {
  padding: 28px 12px;
}
@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* 查用户: one buyer's cards (用户, 收货地址, 积分, 游园局, 新人试玩, 货柜, 最近订单, 售后). */
.buyer-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
}
/* The cards with tables take a whole row; the small ones sit two to a row. */
.buyer-grid > .wide {
  grid-column: 1 / -1;
}
/* A cell keeps to one line, so a row stays a row; the free-text cells (.wrap) may wrap, but not into a sliver. The
   table scrolls sideways (.table-wrap) before any column is squeezed. */
.buyer-grid td {
  white-space: nowrap;
}
.buyer-grid td.wrap {
  white-space: normal;
  min-width: 12em;
}
summary svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--text-3);
  transition: transform 0.2s;
}
details[open] > summary > svg {
  transform: rotate(180deg);
}
td.num {
  white-space: nowrap;
}
/* 已发货清单 (shipped.js): the month picker at its own width, so 导出 CSV stays beside it. */
.toolbar > #shipped-month {
  flex: 0 0 auto;
  width: auto;
}
/* 已发货清单: the 合计 line under the table (shipped.js), set apart from the last line, which has no bottom border. */
/* On a phone the table scrolls sideways rather than squeezing a packing-list name into broken lines. */
.shipped-table td:first-child {
  min-width: 14em;
}
.shipped-table tfoot td {
  border-top: 1px solid var(--border);
  border-bottom: 0;
  font-weight: 600;
}

.stat.date .stat-value {
  font-size: 17px;
  padding-top: 4px;
}
.who strong {
  white-space: nowrap;
}
.thumb-upload img,
.thumb {
  color: transparent;
}
/* The preview note in the top bar gives way first when the bar runs out of room. */
.env .muted {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .card-head {
    flex-wrap: wrap;
  }
  .who strong {
    display: none;
  }
}

/* A cell with an uncommitted preview spans the full grid row so the old/new
   comparison renders at a size an operator can actually judge. */
.board-art-cell.board-art-cell--pending {
  grid-column: 1 / -1;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(35 91 73 / 0.12);
}
.board-art-cell--pending > .label-img {
  max-width: 320px;
}
.board-art-cell--pending .compare {
  grid-template-columns: repeat(2, minmax(0, 280px)) minmax(0, 140px);
  gap: 20px;
  align-items: end;
}
.board-art-cell--pending .compare figure {
  font-size: 12px;
}
@media (max-width: 640px) {
  .board-art-cell--pending .compare {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
}
.board-art-cell--pending form {
  max-width: 440px;
}
/* The new label in its place on the nine-cell board (7 8 9 / 6 5 4 / 1 2 3), as on the phone. */
.board-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: 420px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.board-preview-cell {
  border-radius: var(--radius-sm);
  padding: 2px;
}
.board-preview-cell img {
  display: block;
  width: 100%;
  aspect-ratio: 1.9;
  object-fit: contain;
}
.board-preview-cell.is-new {
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--accent);
}
/* What a player sees when they tap the cell in the mini program. */
.board-tap-preview {
  display: flex;
  gap: 12px;
  align-items: center;
  max-width: 420px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.board-tap-preview img {
  width: 64px;
  height: 64px;
  flex: none;
  object-fit: contain;
}
.board-tap-preview div {
  display: grid;
  gap: 2px;
}
.board-tap-preview span {
  font-size: 12px;
  color: var(--text-3);
}
/* Board prizes in the product table: name and picture are edited under 棋盘奖品. */
.thumb-static {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-3);
}
.thumb-static img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.board-owned-name {
  font-weight: 500;
}
[data-board-link] {
  justify-self: start;
  color: var(--accent);
}
.runlog-json{white-space:pre-wrap;word-break:break-all;max-height:320px;overflow:auto;font-size:12px;margin:6px 0 0}
.runlog-controls{flex-wrap:wrap;gap:12px;align-items:flex-end}
.runlog-msg{border-top:1px dashed var(--line,#e5e0da);padding-top:6px;margin-top:6px}
form.inline { display: flex; gap: 6px; align-items: center; }
form.inline input { width: 110px; }
td details summary { cursor: pointer; color: var(--muted, #667085); font-size: 12px; }
td details table { margin-top: 6px; }

/* Customer service types a user's new address: the lead and the four fields need air between them. */
#address-dialog .field {
  margin-top: 12px;
}

/* Waybill print settings: paper size beside the lead, above the sandboxed label preview. */
.print-settings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 13px;
}
.field.inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.field.inline > span:first-child {
  white-space: nowrap;
}
/* 物流设置 · 寄件地址 on the parcels page. */
.sender-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.sender-form {
  display: grid;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.sender-form h3 {
  margin: 0;
  font-size: 15px;
}
.sender-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
/* Retired styles waiting to be purged, above the product table. */
.card-callout {
  margin: 0 20px 14px;
}
.card-callout .btn {
  margin-left: 8px;
  vertical-align: middle;
}
/* 账号与权限 */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.inline-form .field {
  flex: 1 1 160px;
  min-width: 0;
}
.table-card .inline-form.card-body {
  border-top: 1px solid var(--border);
}
.partner-card {
  box-shadow: none;
  background: var(--surface-2);
}
.partner-card .card-head h3 {
  font-size: 15px;
}
.partner-card .inline-form {
  padding: 14px 20px 18px;
}
.partner-card.is-disabled {
  opacity: 0.7;
}
.form-actions.end {
  justify-content: flex-end;
}
.partner-card > .section-note {
  padding: 0 20px;
}
.login-foot a {
  color: var(--accent);
}
a.btn.ghost {
  text-decoration: none;
}

/* Keep gift deadlines legible and destructive actions reachable inside the scroll area. */
.gift-records table:has(tbody td:not([colspan])) { min-width: 1120px; }
.gift-records table:has(tbody td[colspan]) thead { display: none; }
.gift-records form.inline { flex-wrap: wrap; }
.gift-records form.inline input { width: 220px; flex: 0 0 220px; }
.gift-records th:last-child,
.gift-records td:last-child:not([colspan]) {
  position: sticky;
  right: 0;
  width: 80px;
  min-width: 80px;
  white-space: nowrap;
  background: var(--surface);
  box-shadow: -1px 0 0 var(--border);
}
.gift-records th:last-child { z-index: 2; background: var(--surface-2); }

.gift-records .gift-status {
  position: sticky;
  right: 80px;
  min-width: 140px;
  white-space: nowrap;
  background: var(--surface);
  box-shadow: -1px 0 0 var(--border);
}
.gift-records th.gift-status { z-index: 2; background: var(--surface-2); }
.promoter-profiles code, .promoter-profiles .mono, .promoter-profiles .nowrap { white-space: nowrap; }
/* Keep queued-label approval as readable as the board prize comparison. */
.handoff-cell--pending {
  grid-column: 1 / -1;
  border-color: var(--accent);
}
.handoff-queue .board-art-preview {
  width: 100%;
}
.handoff-queue .compare {
  grid-template-columns: repeat(2, minmax(0, 280px));
  gap: 16px;
}
.handoff-queue .compare img {
  width: 100%;
}

/* 数据 (growth analytics, spec 2026-10-12 §2.2): the range bar, 今日's two cards, and cards of big numbers, one chart and 看明细. */
.analytics-bar {
  display: grid;
  gap: var(--space-2);
}
.analytics-range {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}
.analytics-days {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}
.analytics-days input {
  width: auto;
}
.analytics-status {
  margin: 0;
  font-size: var(--fs-sm);
}
.analytics-status .charts-note {
  margin-left: var(--space-2);
  color: var(--warn);
}
/* ⋯ beside the range: 重新计算. */
.analytics-more {
  position: relative;
}
.analytics-more > summary {
  list-style: none;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  min-width: var(--control-h);
  height: var(--control-h);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
}
.analytics-more > summary::-webkit-details-marker,
.info-pop > summary::-webkit-details-marker {
  display: none;
}
.analytics-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: var(--z-sticky);
  min-width: 140px;
  padding: var(--space-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.today-cards {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}
.chart-card {
  min-width: 0;
}
.origin-picks {
  align-self: flex-start;
}
.origin-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: var(--space-1);
  vertical-align: 1px;
}
.origin-dot.xhs { background: var(--origin-xhs); }
.origin-dot.douyin { background: var(--origin-douyin); }
.origin-dot.tencent { background: var(--origin-tencent); }
.origin-dot.share { background: var(--origin-share); }
.origin-dot.mp { background: var(--origin-mp); }
.origin-dot.search { background: var(--origin-search); }
.origin-dot.frequent { background: var(--origin-frequent); }
.origin-dot.other { background: var(--origin-other); }
/* 数据 → 来源 without ad spend in the range (roi.js): one line across the grid instead of the four spend cards. */
.roi-none {
  grid-column: 1 / -1;
}
/* 广告投放's cost settings: a short amount a cell; a line in red where something will go wrong. */
.roi-costs td input {
  width: 8em;
}
.hint.bad {
  color: var(--danger);
}
/* An origin chart's hover box (origins.js nonZeroTip): a name and its number to the right. */
.tip-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.tip-row b {
  margin-left: auto;
  padding-left: var(--space-4);
}
.split-bar {
  display: flex;
  height: 6px;
  max-width: 160px;
  margin-top: var(--space-1);
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface-3);
}
.split-bar em {
  display: block;
  height: 100%;
}
.split-bar .new { background: var(--origin-new); }
.split-bar .old { background: var(--origin-old); }
.chart-card.wide {
  grid-column: 1 / -1;
}
.chart-card .card-head {
  align-items: center;
}
.chart-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.chart-card .card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
}
.chart-box {
  width: 100%;
  min-width: 0;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--fs-xs);
  color: var(--text-2);
}
.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}
.chart-legend em {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--space-2);
}
.kpi-row .kpi {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  min-width: 0;
}
.kpi-row .kpi span {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.kpi-row .kpi b {
  display: block;
  font-size: var(--fs-xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.kpi-row .kpi i {
  font-style: normal;
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.kpi-row .kpi i {
  display: block;
}
.kpi-row .kpi.bad b {
  color: var(--danger);
}
/* 「比上期」: up in the accent, down in red (for refunds the other way round). */
.kpi-row .kpi i.vs.up {
  color: var(--accent);
}
.kpi-row .kpi i.vs.down {
  color: var(--danger);
}
.kpi-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-xs);
}
/* A chart with nothing to draw in this range. */
.chart-empty {
  margin: 0;
  padding: var(--space-6) 0;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-3);
}
.explain-table > summary {
  width: max-content;
  cursor: pointer;
  color: var(--accent-text);
  font-size: var(--fs-sm);
}
.explain-table[open] > summary {
  margin-bottom: var(--space-2);
}
/* 看明细's tables stay inside their card: a wide one scrolls sideways with its first column held, a long one scrolls down
   under its header, and numbers never wrap into tall cells. */
.explain-table {
  min-width: 0;
}
.explain-table .table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.explain-table th,
.explain-table td {
  white-space: nowrap;
}
.explain-table .table-wrap > table > * > tr > :first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
}
.explain-table .table-wrap > table > thead > tr > :first-child {
  z-index: 2;
  background: var(--surface-2);
}
.explain-table .table-wrap + .section-label {
  margin-top: var(--space-4);
}
/* ⓘ: a card's explanation in a small popover under its title. */
.info-pop {
  position: relative;
}
.info-pop > summary {
  list-style: none;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.info-body {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: var(--z-sticky);
  display: grid;
  gap: var(--space-2);
  width: min(420px, 80vw);
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-2);
}
@media (max-width: 900px) {
  .today-cards,
  .chart-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .info-body {
    width: min(360px, calc(100vw - 48px));
  }
}

/* A card's ⓘ opens across the card under its head, never past the card's right edge (a card in the right column). */
.chart-card .card-head {
  position: relative;
}
.chart-card .info-pop {
  position: static;
}
.chart-card .info-body {
  left: var(--space-4);
  right: var(--space-4);
  width: auto;
  max-width: 520px;
  top: calc(100% - 4px);
}

/* Analytics phase 2: separate related count lines in today's card and the checkout lists. */
.analytics-lines {
  display: grid;
  gap: 6px;
}

/* ---------- 更新说明 ---------- */
/* The strip under the top bar, lined up with the page below it. */
.updates-strip {
  align-items: center;
  flex-wrap: wrap;
  max-width: calc(1360px - 64px);
  margin: 16px 32px 0;
}
.updates-strip svg {
  margin-top: 0;
}
.updates-strip p {
  flex: 1 1 260px;
  margin: 0;
  line-height: 1.6;
}
.updates-strip-actions {
  display: flex;
  gap: 8px;
  flex: none;
}
.updates-list {
  margin-top: 16px;
  max-height: 62vh;
  overflow-y: auto;
  padding-right: 4px;
}
.update + .update {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.update h3 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 15px;
}
.update-date {
  flex: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-text);
}
.update-app {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-3);
}
.update ul {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 18px;
}
.update li {
  font-size: 14px;
  line-height: 1.65;
}
.update-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-left: 6px;
  vertical-align: baseline;
}
.update-links .btn.sm {
  min-height: 0;
  padding: 0 6px;
  color: var(--accent);
}
@media (max-width: 900px) {
  .updates-strip {
    margin: 12px 16px 0;
  }
}
/* A personal partner account has four buttons up there (更新说明, 操作指引, 修改密码, 退出): on a phone they sit closer. */
@media (max-width: 640px) {
  .identity {
    gap: 4px;
  }
  .identity .btn.sm {
    padding: 0 6px;
  }
}

/* ---------- Phone cards (spec 2026-10-06 §2.6) ----------
   On a phone a table.cards row is a card: its first cell the title, the others "label: value" (each td's data-label),
   the actions cell a row of buttons. A cell spanning the row (a group heading) becomes a heading between cards. */
@media (max-width: 640px) {
  .page-intro {
    max-width: none;
  }
  .intro-text {
    -webkit-line-clamp: 1;
  }
  .form-stack .field > input[type="number"],
  .form-stack .field > select {
    max-width: none;
  }
  /* A card's actions fill the row on a phone: easier to hit with a thumb. */
  .card-foot > .btn,
  .card-foot > button {
    flex: 1 1 auto;
  }
  /* 查用户's tables as cards: a cell may wrap there. */
  .buyer-grid table.cards td {
    white-space: normal;
  }
  /* 工作台更新了 in one line: a tap on it opens the notes, 知道了 stays. */
  .updates-strip {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 8px 10px;
  }
  .updates-strip > svg,
  #updates-strip-open {
    display: none;
  }
  .updates-strip p {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
  }
  table.cards,
  table.cards > tbody,
  table.cards > tbody > tr,
  table.cards > tbody > tr > td {
    display: block;
    width: 100%;
  }
  table.cards > thead {
    display: none;
  }
  table.cards > tbody > tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    padding: var(--space-3);
    margin-bottom: var(--space-3);
  }
  table.cards > tbody > tr > td {
    display: grid;
    grid-template-columns: 6.5em minmax(0, 1fr);
    gap: var(--space-2);
    align-items: start;
    padding: 3px 0;
    border: 0;
    text-align: left;
  }
  table.cards > tbody > tr > td::before {
    content: attr(data-label);
    padding-top: 2px;
    color: var(--text-3);
    font-size: var(--fs-xs);
  }
  table.cards > tbody > tr > td:first-child,
  table.cards > tbody > tr > td:not([data-label]),
  table.cards > tbody > tr > td[colspan] {
    grid-template-columns: minmax(0, 1fr);
  }
  table.cards > tbody > tr > td:first-child::before,
  table.cards > tbody > tr > td[colspan]::before,
  table.cards > tbody > tr > th[colspan]::before,
  table.cards > tbody > tr > td:not([data-label])::before {
    content: none;
  }
  table.cards > tbody > tr > td:first-child {
    font-weight: 600;
    padding-bottom: var(--space-2);
  }
  table.cards > tbody > tr > td:not([data-label]):not(:first-child) {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding-top: var(--space-2);
  }
  table.cards > tbody > tr > th[colspan] {
    display: block;
    padding: 4px 0;
    border: 0;
    background: none;
    text-align: left;
  }
  table.cards > tbody > tr:has(> td[colspan]),
  table.cards > tbody > tr:has(> th[colspan]) {
    border: 0;
    background: none;
    padding: var(--space-2) 0 0;
    margin: 0;
  }
  /* A wide table of numbers scrolls sideways inside its box; its first column stays put. */
  .table-wrap[data-scroll] > table > * > tr > :first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--surface);
  }
  .table-wrap[data-scroll] > table > thead > tr > :first-child {
    z-index: 2;
    background: var(--surface-2);
  }
  .table-wrap:has(> table.cards) {
    overflow: visible;
    border: 0;
    background: none;
    box-shadow: none;
  }
}

/* 园长小屋 (spec 2026-10-11): a switch row, a round whose seats outrun its stock, an image field with its upload. */
.hub-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.hub-switch p {
  margin: 4px 0 0;
}
tr.hub-short,
tr.hub-short > td {
  background: var(--warn-soft);
}
.hub-image {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hub-image input:not([type="file"]),
.hub-image select {
  flex: 1 1 220px;
  min-width: 0;
}
.hub-image img {
  border-radius: 6px;
  object-fit: cover;
}
.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .hub-switch {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Mall scene management: whole images in each preview, at phone reading width. */
.scene-thumb {
  width: 54px;
  height: 72px;
  object-fit: contain;
  background: var(--surface-2);
}
.scene-editor {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.scene-editor label {
  display: grid;
  gap: var(--space-2);
}
.scene-fields,
.scene-images,
.scene-previews {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  min-width: 0;
}
.scene-fields > label {
  flex: 1 1 240px;
  min-width: 0;
}
.scene-images figure {
  width: 200px;
  margin: 0;
}
.scene-images img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: contain;
  background: var(--surface-2);
}
.scene-images figcaption {
  margin: var(--space-2) 0;
}
.scene-previews > section {
  width: 100%;
  max-width: 320px;
  min-width: 0;
}
.scene-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.scene-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}
.scene-card {
  aspect-ratio: 3 / 4;
}
.scene-share {
  aspect-ratio: 5 / 4;
}
.scene-carousel {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}
.scene-carousel figure {
  flex: 0 0 100%;
  min-width: 0;
  margin: 0;
  scroll-snap-align: start;
}
.scene-intro-preview {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#scene-count.danger-text {
  color: var(--danger);
  font-weight: 700;
}
