:root {
  --bg: #f0ebe0;
  --ink: #1c2416;
  --card: #fffdf8;
  --line: #ddd4c0;
  --line-strong: #cfc3a8;
  --green: #1f6b4a;
  --green-d: #14352b;
  --amber: #c47b12;
  --red: #a33b32;
  --muted: #6d675c;
  --muted-2: #938b7c;
  --shadow: 0 10px 28px rgba(28, 36, 22, 0.1);
  --shadow-sm: 0 2px 8px rgba(28, 36, 22, 0.07);
  font-family: "Segoe UI", "Nirmala UI", "Noto Sans Bengali", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: 28px;
}
button, input, select, textarea { font: inherit; color: inherit; }
input:focus, select:focus, textarea:focus { border-color: var(--green); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
.top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  background: linear-gradient(160deg, #184a36, var(--green-d));
  color: #f6f3ea;
}
.top-stats { display: none; flex: 0 0 100%; flex-wrap: wrap; gap: 4px 18px; align-items: baseline; font-size: 12.5px; opacity: 0.95; margin-top: 2px; }
.top-stats span { white-space: nowrap; }
.top-stats b { margin-left: 5px; font-size: 14.5px; }
@media (min-width: 1100px) {
  .top-stats { display: flex; border-top: 1px solid rgba(255, 255, 255, 0.14); padding-top: 9px; }
  main > .global-stats { display: none; }
}
.head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.who-row { display: flex; gap: 8px; }
.who {
  border: 0;
  background: rgba(255,255,255,0.12);
  color: #f6f3ea;
  border-radius: 999px;
  min-height: 34px;
  padding: 4px 14px;
  font-size: 12.5px;
}
.who.logout { background: rgba(163, 59, 50, 0.45); font-weight: 700; }
.gate-card .hint:empty { display: none; }
.gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(16, 24, 15, 0.97);
  display: grid;
  place-items: center;
  padding: 16px;
}
.gate-card { width: min(420px, 100%); margin: 0; }
body.is-staff [data-tab="customers"],
body.is-staff [data-tab="logs"] { display: none; }
.brand { min-width: 0; flex: 1; }
.top strong { display: block; font-size: 19px; line-height: 1.2; letter-spacing: 0.01em; }
.clocks { font-size: 12px; line-height: 1.4; opacity: 0.78; margin-top: 5px; white-space: pre-line; }
.langs { display: flex; gap: 4px; flex: 0 0 auto; background: rgba(255,255,255,0.1); border-radius: 12px; padding: 3px; }
.langs button {
  border: 0;
  background: transparent;
  color: #f6f3ea;
  border-radius: 9px;
  min-height: 36px;
  padding: 6px 8px;
  font-size: 13px;
}
.langs button.on { background: #f3efe6; color: var(--green-d); font-weight: 700; }
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 12px;
  background: linear-gradient(180deg, #16382c 0%, #12291f 100%);
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 8px 18px rgba(18, 41, 31, 0.22);
}
.tabs button {
  flex: 1 1 auto;
  min-width: 84px;
  border: 0;
  border-radius: 999px;
  min-height: 40px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(246, 243, 234, 0.82);
  white-space: nowrap;
  line-height: 1.15;
  text-align: center;
  font-size: 14px;
}
.tabs button.on {
  background: #f3efe6;
  color: var(--green-d);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18), inset 0 0 0 2px var(--amber);
}
.ghost, .primary {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: transparent;
  color: #f6f3ea;
  white-space: nowrap;
}
.hidden { display: none !important; }
main { padding: 12px; max-width: 980px; margin: 0 auto; }
.panel.hidden { display: none !important; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
h2 { margin: 0 0 12px; font-size: 17px; letter-spacing: 0.01em; }
h2::after { content: ""; display: block; width: 26px; height: 3px; border-radius: 2px; background: var(--amber); margin-top: 5px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
label.check { flex-direction: row; align-items: center; color: var(--ink); flex: 0 0 auto; white-space: nowrap; }
label.check span { white-space: nowrap; }
.between > h2 { flex: 0 0 auto; white-space: nowrap; }
.card > .between { flex-wrap: wrap; }
.settle { margin-top: 22px; }
.hint { font-size: 13px; color: var(--muted); }
.dir { display: flex; gap: 6px; margin-top: 6px; }
.dir button { border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; padding: 6px 12px; }
.dir button.on { background: var(--green-d); color: white; border-color: var(--green-d); }
.photo input { padding: 8px; background: #fff; }
.photo.cam {
  border: 1.5px dashed var(--green);
  border-radius: 14px;
  padding: 12px;
  background: #f4faf6;
  color: var(--green-d);
  font-weight: 700;
}
.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 10px; flex-wrap: wrap; }
.pager button { min-width: 44px; min-height: 44px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); border-radius: 999px; padding: 6px 14px; }
.pager button:disabled { opacity: 0.4; }
.pager span { color: var(--muted); font-size: 13px; }
.pager .pg-nums { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pager .pg-num { min-width: 40px; padding: 6px 8px; font-variant-numeric: tabular-nums; }
.pager .pg-num.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; opacity: 1; }
.pager .pg-jump { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.pager .pg-input { width: 64px; min-height: 40px; border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 12px; text-align: center; font-size: 14px; background: #fff; color: var(--ink); }
.pager .pg-input::-webkit-outer-spin-button, .pager .pg-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pager .pg-input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.pager .pg-go { min-width: 40px; padding: 6px 12px; }
.price-tbl { width: 100%; border-collapse: collapse; margin: 4px 0; }
.price-tbl th { font-size: 10.5px; color: var(--muted); font-weight: 600; text-align: left; padding: 1px 4px 2px 0; border: 0; }
.price-tbl td { font-size: 12.5px; padding: 1px 4px 2px 0; border: 0; white-space: nowrap; }
.price-tbl th:not(:first-child), .price-tbl td:not(:first-child) { padding-left: 10px; }
.ptable td:nth-child(7), .ptable td:nth-child(8), .ptable td:nth-child(9) { white-space: nowrap; }
.tag.fac { background: #f8edd8; color: #8a5a10; font-weight: 700; }
.tag.bat { background: #e4e8f4; color: #3b5a8a; font-weight: 600; }
.tag.cst { background: #f4dde4; color: #8a3b52; font-weight: 700; }
.tag.stk { background: #e4efe8; color: var(--green-d); font-weight: 600; }
.fac-no { color: var(--amber); font-size: 15px; white-space: nowrap; }
.gap8 { gap: 8px; }
.previews, .thumbs { display: flex; gap: 8px; overflow: auto; padding-top: 6px; }
.previews img, .thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #efe8d8; }
input, select {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  box-shadow: inset 0 1px 2px rgba(28, 36, 22, 0.04);
}
.row2, .row3 { display: grid; gap: 10px; }
.row2 { grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 1fr 1fr 1fr; }
.primary, .danger, .warn {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 13px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.01em;
  box-shadow: 0 3px 10px rgba(31, 107, 74, 0.22);
}
.primary { background: linear-gradient(180deg, #287b57, #1f6b4a); }
.primary:active { transform: translateY(1px); }
.danger { background: linear-gradient(180deg, #b5473d, #a33b32); box-shadow: 0 3px 10px rgba(163, 59, 50, 0.2); }
.warn { background: linear-gradient(180deg, #d18a1a, #c47b12); box-shadow: 0 3px 10px rgba(196, 123, 18, 0.2); }
.ghost {
  background: #f6f0e2;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 14px;
}
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; max-width: 460px; margin-left: auto; margin-right: auto; }
.steps button { border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; min-height: 40px; color: var(--muted); font-weight: 600; }
.steps button.on { background: var(--green-d); color: white; border-color: var(--green-d); font-weight: 700; }
.kind-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
#logActions { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.log-row { width: 100%; text-align: left; border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 12px; padding: 11px; margin-bottom: 8px; box-shadow: var(--shadow-sm); }
.log-row small { color: var(--muted); display: block; }
textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px; font: 12px ui-monospace, Consolas, monospace; }
.kind-list button { border: 1.5px solid var(--line-strong); background: #fff; color: var(--ink); border-radius: 12px; min-height: 46px; font-weight: 600; }
.kind-list button.on { background: #e4efe8; color: var(--green-d); border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.pick { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; margin: 8px 0; }
.pick-side, .pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick button { text-align: left; border: 1px solid var(--line-strong); background: white; color: var(--ink); border-radius: 10px; min-height: 40px; padding: 8px 10px; }
.pick button.on { background: #e4efe8; color: var(--green-d); border-color: var(--green); font-weight: 600; }
.facet-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: start; }
.facet-label { font-size: 13px; font-weight: 700; color: var(--muted); padding-top: 7px; }
.facet-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.facet-chips button { text-align: left; border: 1px solid var(--line-strong); background: white; color: var(--ink); border-radius: 999px; min-height: 32px; padding: 5px 13px; white-space: nowrap; font-size: 13px; }
.facet-chips button.on { background: var(--green-d); color: white; border-color: var(--green-d); font-weight: 700; box-shadow: 0 1px 4px rgba(20, 53, 43, 0.22); }
.plist { display: grid; grid-template-columns: 1fr; gap: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
.prow { display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-template-areas: "photo info" "quantity quantity"; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 10px; background: white; box-shadow: var(--shadow-sm); }
.prow .goods-info { grid-area: info; min-width: 0; }
.prow .goods-code-line { max-width: 100%; overflow-x: auto; }
.prow .goods-code { display: block; white-space: nowrap; word-break: normal; overflow-wrap: normal; }
.prow .goods-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 3px 0; }
.prow .goods-badges .tag { margin: 0; }
.prow .goods-stock { display: block; }
.prow .stepper { grid-area: quantity; justify-self: end; }
.prow > img, .prow > .ph { grid-area: photo; }
.prow img, .prow .ph { width: 64px; height: 64px; border-radius: 10px; }
.prow .ph { font-size: 10px; padding: 2px; overflow: hidden; }
.prow b { font-size: 15px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font-size: 18px; flex: 0 0 auto; }
.stepper b { min-width: 1.6em; text-align: center; font-size: 16px; }
.stepper .qty-set { width: 64px; min-width: 64px; height: 38px; padding: 2px 4px; text-align: center; font-size: 16px; font-weight: 700; border-radius: 10px; }
.stepper .add-ten-btn { width: 52px; min-height: 38px; padding: 4px 6px; font-size: 13px; font-weight: 700; white-space: nowrap; background: var(--green); border-color: var(--green); color: #fff; }
.filters { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; }
.filters:empty { display: none; }
#buyers { flex-direction: row; flex-wrap: wrap; align-items: center; }
#buyers .chip { flex: 0 0 auto; }
.filter-row { display: flex; gap: 6px; overflow: auto; }
.combo-custom { margin-top: 6px; border: 1px dashed var(--amber); background: #fffdf4; }
.chip {
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  white-space: nowrap;
}
.chip.on { background: #e4efe8; color: var(--green-d); border-color: var(--green); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.tile {
  border: 1px solid var(--line);
  background: white;
  border-radius: 14px;
  overflow: hidden;
  text-align: left;
  padding: 0;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.tile img, .ph {
  width: 100%;
  height: 110px;
  object-fit: cover;
  background: #efe8d8;
  display: block;
}
.ph { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.tile .meta { padding: 8px; }
.tile b { display: block; }
.tile small { color: var(--muted); }
.between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
#cart .line.price-bad { background: #fdeeeb; border-radius: 12px; padding: 10px 12px; margin: 6px 0; border-bottom-color: #eec5bd; }
.price-bad-hint { color: var(--red); font-size: 12px; font-weight: 700; margin: 2px 0 0; }
.qty {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.qty .ghost { flex: 0 0 auto; width: auto; min-width: 52px; min-height: 38px; }
.qty button { min-height: 38px; }
.qty button {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
}
.qty input, .amt input { width: 72px; padding: 8px; text-align: center; }
#cart .line { align-items: center; }
.total { display: flex; justify-content: space-between; font-size: 21px; margin: 8px 0 12px; align-items: baseline; }
.total b { font-size: 26px; color: var(--green-d); }
.confirm-grid { display: grid; gap: 24px; }
.confirm-content { display: grid; align-content: start; gap: 24px; min-width: 0; }
.confirm-info { border: 1px solid #c8d9c8; border-top: 4px solid var(--green); border-radius: 14px; padding: 20px; margin-bottom: 22px; background: #eef5ec; }
.confirm-info-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.confirm-info-head strong { font-size: 19px; color: var(--green-d); }
.confirm-info-head p { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 6px 0 0; }
.confirm-order-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.confirm-order-meta span { background: #fff; border: 1px solid #d3e0d0; border-radius: 999px; padding: 5px 10px; color: var(--green-d); font-size: 13px; }
.ci-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.confirm-info label { margin: 0; color: var(--ink); font-weight: 600; gap: 7px; }
.confirm-info input { font-size: 18px; }
.confirm-info select { font-size: 17px; }
.confirm-items { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 18px; min-width: 0; }
.confirm-support { border-top: 1px solid #cfddce; padding-top: 14px; margin-top: 14px; min-width: 0; }
.confirm-support > h3 { margin: 0 0 12px; font-size: 16px; color: var(--green-d); }
.confirm-support .order-note { margin: 0 0 12px; }
.confirm-support .attachment-panel { border: 0; background: transparent; border-radius: 0; padding: 0; margin: 0; }
.confirm-support .photo.cam { padding: 10px; font-size: 13px; }
.confirm-support input[type="file"] { font-size: 13px; min-width: 0; padding: 8px; }
.confirm-support .hint { font-size: 12px; line-height: 1.5; margin-top: 6px; }
.save-customer-review { border-top: 1px solid #cfddce; padding: 12px 2px; display: grid; gap: 4px; margin: 12px 0 4px; }
.save-customer-review > span { color: var(--muted); font-size: 12px; }
.save-customer-review strong { font-size: 18px; color: var(--green-d); overflow-wrap: anywhere; }
.save-customer-review small { color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
@media (max-width: 699px) {
  .confirm-info { padding: 14px; margin-bottom: 16px; }
  .confirm-items { padding: 12px; }
}
.msg { min-height: 1.2em; margin-top: 8px; color: var(--green-d); }
.msg.bad { color: var(--red); }
.order {
  background: white;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 14px;
  padding: 13px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}
.order.return { border-left-color: var(--red); }
.order.exchange { border-left-color: var(--amber); }
.order .between > b:last-child { font-size: 19px; color: var(--green-d); }
.order .oline { display: block; margin-top: 4px; color: var(--muted); }
.order .otime { font-size: 12px; margin-top: 8px; }
.order-filters { display: grid; grid-template-columns: 148px 148px 112px minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.order-filters #reloadOrders { min-height: 44px; }
.quick-dates { display: flex; gap: 4px; flex-wrap: wrap; }
.quick-dates button { border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; padding: 5px 11px; min-height: 32px; white-space: nowrap; }
.quick-dates button.on { background: #e4efe8; color: var(--green-d); border-color: var(--green); font-weight: 700; }
.edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: #f8e7c8;
  border: 1px solid var(--amber);
  color: #7a5410;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 13.5px;
}
.edit-banner .ghost { background: #fff; border: 1px solid var(--amber); color: #7a5410; flex: 0 0 auto; }
.previews .prev { position: relative; display: inline-flex; }
.previews .prev-x {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--red);
  font-size: 14px;
  line-height: 1;
  z-index: 2;
}
.of-group { margin-top: 8px; }
.of-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.of-bottom .check { margin: 0; }
.view-switch { display: flex; background: #efe8d8; border-radius: 999px; padding: 3px; border: 1px solid var(--line-strong); }
.view-switch button { border: 0; background: transparent; border-radius: 999px; min-height: 34px; padding: 6px 12px; color: var(--muted); white-space: nowrap; }
.view-switch button.on { background: white; color: var(--green-d); font-weight: 700; box-shadow: 0 1px 4px rgba(28, 36, 22, 0.12); }

.order-list-row {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}
.orow-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.orow-line.sale { border-left: 4px solid var(--green); padding-left: 8px; }
.orow-line.return { border-left: 4px solid var(--red); padding-left: 8px; }
.orow-line.exchange { border-left: 4px solid var(--amber); padding-left: 8px; }
.orow-main { min-width: 0; }
.orow-items { margin-top: 4px; }
.orow-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.orow-side b { color: var(--green-d); }
.orow-side .actions { margin-top: 0; }
.otable .oitems-cell .oitem { border: 0; padding: 2px 0; }
.otable td { vertical-align: top; }
.otable .due { color: var(--red); font-weight: 700; }
@media (max-width: 699px) {
  .orow-line { grid-template-columns: 1fr; }
  .orow-side { flex-direction: row; align-items: center; justify-content: space-between; }
}
@media (max-width: 699px) {
  .order-filters { grid-template-columns: 1fr 1fr; }
  .order-filters .of-search { grid-column: 1 / -1; }
}
@media (min-width: 700px) and (max-width: 1099px) {
  .order-filters { grid-template-columns: 1fr 1fr; }
  .order-filters .of-search { grid-column: 1 / -1; }
  .order-filters #reloadOrders { min-height: 44px; }
}
.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  background: #efe8d8;
  margin-right: 4px;
  color: #574f43;
}
.tag.sale { background: #d9efe3; color: #174d35; }
.tag.return { background: #f8d9d4; color: #7c2a24; }
.tag.exchange { background: #f8e7c8; color: #7a5410; }
.tag.no { background: #f8d9d4; color: var(--red); }
.actions { display: flex; gap: 8px; margin-top: 10px; }
.actions:empty { display: none; }
.oitems { margin-top: 6px; border-top: 1px dashed var(--line-strong); }
.oitem {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px dotted var(--line);
  font-size: 13.5px;
  align-items: baseline;
}
.oitem .oi-code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oitem .oi-qty { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.oitem .oi-amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.oitem.in .oi-code, .oitem.in .oi-amt { color: var(--red); }
.oi-toggle {
  border: 0;
  background: none;
  color: var(--green);
  padding: 6px 0 2px;
  font-size: 13px;
  text-align: left;
  min-height: 36px;
  font-weight: 600;
}
.bad-hint { color: var(--red); margin: -4px 0 8px; font-size: 12.5px; }
.pager .all-btn { flex: 1; }
.diff { margin-top: 10px; font-size: 12.5px; }
.diff-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; padding: 5px 0; border-bottom: 1px dotted var(--line); align-items: start; }
.diff-row.head { font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line-strong); }
.diff-row .dk { color: var(--muted); overflow-wrap: break-word; }
.diff-row .dv { font-family: ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }
.diff-row.chg { background: #f6f2df; border-radius: 6px; padding: 5px 6px; }
.diff-row.chg .dk { color: var(--ink); font-weight: 700; }
.diff-row.chg .dv { color: var(--ink); }
.diff-row.same { opacity: 0.55; }
#cart { overflow: visible; }
#cart .line { grid-template-columns: auto minmax(0, 1fr) auto; }
#cart .line.no-thumb { grid-template-columns: minmax(0, 1fr) auto; }
#cart .amt { min-width: 80px; }
#cart .amt input { width: 80px; }
#cart .amt small { display: block; white-space: nowrap; }
.cart-thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); cursor: zoom-in; flex: 0 0 auto; align-self: start; }
.cart-info { min-width: 0; }
.cart-prices { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 4px 0; }
.cart-prices .cp { font-size: 11.5px; color: var(--muted); white-space: nowrap; background: #efe8d8; border-radius: 999px; padding: 2px 8px; }
.cart-prices .cp.cur { color: var(--green-d); font-weight: 700; background: #e4efe8; }
.cart-prices .cp.calc { background: transparent; border: 1px dashed var(--line); padding: 1px 7px; color: var(--muted-2); }
.cart-prices .cp.calc.cur { color: var(--green-d); background: #e4efe8; }
.bill .total { margin-bottom: 4px; }
.bill-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 15px; color: var(--muted); margin: 2px 0 6px; }
.bill-line .disc { font-size: 17px; color: var(--amber); font-weight: 700; }
.confirm-items { min-width: 0; }
.cart-heading { margin-bottom: 10px; }
.cart-heading > span { color: var(--muted); font-size: 13px; }
.order-note { margin: 14px 0; }
.attachment-panel { border: 1px solid var(--line); background: #fbfcf9; border-radius: 14px; padding: 12px; margin-top: 14px; }
.attachment-panel .photo.cam { margin-bottom: 4px; }
.attachment-panel .hint { line-height: 1.5; margin-bottom: 0; }
.settlement-panel { min-width: 0; border: 1px solid #cdddcf; border-radius: 16px; background: #f3f7f2; padding: 18px; box-shadow: 0 4px 16px rgba(20, 53, 43, 0.06); }
.settlement-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.settlement-heading > strong { font-size: 18px; color: var(--green-d); }
.currency-tag { display: grid; place-items: center; background: #e1ebdf; color: var(--green-d); width: 30px; height: 30px; border-radius: 50%; }
.gross-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 0 14px; margin-bottom: 14px; border-bottom: 1px solid #d4dfd2; color: var(--muted); font-size: 14px; }
.gross-line b { color: var(--ink); font-size: 22px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.settlement-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
.settlement-field { min-width: 0; background: #fff; border: 1px solid #dde5db; border-radius: 12px; padding: 12px; }
.settlement-field > label { display: block; font-size: 13px; font-weight: 700; color: var(--ink); margin: 0 0 8px; line-height: 1.4; }
.money-input { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 9px; background: white; overflow: hidden; }
.money-input:focus-within { outline: 2px solid #b9d7bd; border-color: var(--green); }
.money-input > span { flex: 0 0 auto; padding: 0 10px; color: var(--muted); font-size: 14px; }
.money-input input { min-width: 0; flex: 1 1 0; width: 100%; border: 0; border-radius: 0; box-shadow: none; outline: none; text-align: right; padding: 10px; font-size: 19px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.settlement-field > small { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 8px; }
.field-result { display: block; margin-top: 6px; font-size: 12px; font-weight: 600; color: #8a5a10; }
.settlement-breakdown { padding: 12px 2px; margin: 3px 0; }
.settlement-breakdown > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; color: var(--muted); font-size: 13px; padding: 5px 0; }
.settlement-breakdown b { color: #8a5a10; white-space: nowrap; font-variant-numeric: tabular-nums; }
.settlement-breakdown .net-line { color: var(--ink); font-size: 15px; font-weight: 700; }
.settlement-breakdown .net-line b { color: var(--green-d); font-size: 20px; }
.debt-field { border-left: 3px solid #c79236; }
.receipt-summary { margin: 14px 0; padding: 16px; background: linear-gradient(135deg, #153b2e, #245840); color: #fff; border-radius: 12px; }
.receipt-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.receipt-summary > b { display: block; font-size: 32px; line-height: 1.3; font-variant-numeric: tabular-nums; margin: 8px 0; overflow-wrap: anywhere; }
.receipt-summary > small { display: block; font-size: 12px; color: #d4e4d8; line-height: 1.5; }
.payment-status { border-radius: 999px; padding: 3px 8px; background: rgba(255, 255, 255, 0.14); color: #e2f1df; font-size: 11px; }
.payment-status.has-debt { background: #fae7c5; color: #775016; }
.payment-status:empty { display: none; }
.payment-error { background: #fce8e3; border: 1px solid #efc0b7; color: var(--red); padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; margin: 12px 0; }
.settlement-panel > .msg { font-size: 13px; line-height: 1.5; }
.settlement-panel > .msg:empty { display: none; }
#slipPreview { flex-wrap: wrap; padding: 8px 6px; }
#slipCount { margin: 0; }
input[aria-invalid="true"] { background: #fff3ef; color: var(--red); }
@media (max-width: 699px) {
  .settlement-panel { padding: 14px; }
  .settlement-fields { grid-template-columns: 1fr; }
  .settlement-field { padding: 12px; }
  .settlement-field > small { margin-top: 6px; }
  .receipt-summary > b { font-size: 30px; }
}
.item-notes { margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 6px; }
.item-notes .line { grid-template-columns: 80px 1fr; padding: 4px 0; border-bottom: 0; }
.item-notes .line small { color: var(--amber); font-size: 13px; }
.d-item { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px dotted var(--line); }
.d-thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); cursor: zoom-in; }
.d-thumb.ph { display: grid; place-items: center; color: var(--muted); font-size: 12px; background: #efe8d8; }
.d-info { min-width: 0; }
.d-info b { display: block; font-size: 15px; }
.d-info small { display: block; color: var(--muted); margin-top: 2px; }
.d-note { color: var(--amber) !important; font-size: 13px; }
.line-note { width: 100%; margin-top: 6px; font-size: 13px; padding: 6px 8px; border: 1px dashed var(--line-strong); border-radius: 8px; background: #fbf8f0; color: var(--ink); }
.cart-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 20;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 10px 18px;
  box-shadow: 0 10px 24px rgba(28, 36, 22, 0.16);
  max-width: calc(100vw - 24px);
}
.cart-bar.show { display: flex; }
.cart-bar b { font-size: 20px; color: var(--green-d); }
.cart-bar .primary { width: auto; flex: 0 0 auto; margin: 0; min-width: 132px; }
.slip-missing { color: #835819; background: #fff0cf; border-radius: 8px; padding: 6px 10px; margin-top: 6px; }
@media (max-width: 699px) {
  .cart-bar {
    display: flex;
    position: sticky;
    left: auto;
    bottom: 0;
    transform: none;
    z-index: 3;
    border: 0;
    border-top: 1px solid var(--line-strong);
    border-radius: 0;
    padding: 10px 0 6px;
    box-shadow: 0 -8px 16px rgba(28, 36, 22, 0.1);
    max-width: none;
  }
  #saveOrder { display: none; }
}
.user-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.user-card.off { opacity: 0.7; }
.user-card.me { border-color: var(--green); background: #f4faf6; }
.user-head { display: flex; gap: 12px; align-items: center; }
.avatar {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: white;
  background: var(--green);
}
.avatar.boss { background: var(--green-d); }
.avatar.staff { background: var(--amber); }
.user-id { min-width: 0; }
.user-id b { display: block; font-size: 16px; }
.user-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.user-id small { color: var(--muted); }
.tag.boss { background: #e4efe8; color: var(--green-d); }
.tag.staff { background: #f8edd8; color: #8a5a10; }
.tag.on { background: #e4efe8; color: var(--green-d); }
.tag.me { background: var(--green-d); color: #f6f3ea; }
.user-card .rowbtns { margin-top: 10px; }
.user-card .rowbtns .ghost { background: #f6f0e2; color: var(--ink); width: auto; }
.user-card .rowbtns .danger { color: var(--red); }
.reset-box { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.reset-box .primary { width: auto; margin: 0; }
.reset-box .hint { display: block; margin-top: 4px; }
.actions button { flex: 1; }
.pcard {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}
.pcard.off { opacity: 0.62; }
.pcard img, .pcard .ph { width: 100%; height: 140px; border-radius: 10px; object-fit: cover; }
.pinfo { min-width: 0; }
.pinfo > b { font-size: 15px; }
.pcard .actions { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.pcard .actions button { min-height: 40px; padding: 8px 4px; white-space: normal; }
.tool-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 14px; }
.tool-row .primary { background: var(--green); color: white; width: auto; box-shadow: 0 3px 10px rgba(31, 107, 74, 0.22); }
.tool-row .ghost { background: #f6f0e2; color: var(--ink); width: auto; border: 1px solid var(--line-strong); }
.sort-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.sort-chip { border: 1px solid var(--line-strong); background: #f6f0e2; color: var(--ink); border-radius: 999px; min-height: 32px; padding: 4px 12px; font-size: 13px; white-space: nowrap; cursor: pointer; }
.sort-chip:hover { border-color: var(--green-d); color: var(--green-d); }
.sort-chip .ind { margin-left: 4px; opacity: 0.5; }
.sort-chip.on { background: var(--green); border-color: var(--green); color: white; font-weight: 700; }
.sort-chip.on .ind { opacity: 1; }
.ptable th.sortable { cursor: pointer; user-select: none; }
.ptable th.sortable:hover { color: var(--green-d); }
.ptable th.sortable.on { color: var(--green-d); }
.ptable th.sortable .sort-ind { margin-left: 3px; opacity: 0.45; }
.ptable th.sortable.on .sort-ind { opacity: 1; font-weight: 700; }
.ptable-wrap { overflow-x: auto; grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 12px; background: white; }
#reportTop .ptable-wrap { overflow: visible; }
#reportTop .ptable { min-width: 0; }
.ptable { width: 100%; min-width: 1150px; border-collapse: collapse; }
.ptable th { white-space: nowrap; color: var(--muted); font-weight: 600; background: #f6f0e2; padding: 10px 10px; text-align: left; }
.ptable td { background: white; padding: 9px 10px; border-top: 1px solid var(--line); }
.ptable tr.off td { opacity: 0.62; }
.ptable .thumb, .ptable .ph { width: 72px; height: 54px; border-radius: 8px; object-fit: cover; }
.ptable td.ops, .ptable th.ops { white-space: nowrap; }
.ptable th.video-col, .ptable td.video-col { white-space: nowrap; }
#productAdmin .ptable td:nth-child(10), #productAdmin .ptable td:nth-child(11), #productAdmin .ptable td:nth-child(12), #productAdmin .ptable td:nth-child(13) { white-space: nowrap; }
.ptable .actions { display: flex; gap: 6px; margin-top: 0; }
.ptable .actions button { flex: 0 0 auto; min-width: 64px; min-height: 36px; padding: 6px 12px; background: #f6f0e2; color: var(--ink); white-space: nowrap; }
.plist-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) max-content;
  grid-template-areas: "pic info vid" "acts acts acts";
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px;
  background: white;
  box-shadow: var(--shadow-sm);
}
.plist-row.off { opacity: 0.62; }
.plist-row .thumb, .plist-row .ph { grid-area: pic; width: 64px; height: 64px; border-radius: 10px; }
.plist-row .pinfo { grid-area: info; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.plist-row .pinfo > b { font-size: 15px; }
.plist-row .pinfo small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist-row .plist-video { grid-area: vid; align-self: center; }
.plist-row .actions { grid-area: acts; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.plist-row .actions button { min-height: 40px; padding: 6px 2px; background: #f6f0e2; color: var(--ink); white-space: nowrap; }
.drawer { position: fixed; inset: 0; z-index: 25; display: grid; grid-template-columns: 1fr minmax(280px, 440px); }
.drawer-mask { border: 0; background: rgba(20, 28, 18, 0.45); }
.drawer-card {
  background: var(--card);
  height: 100%;
  overflow: auto;
  padding: 14px;
  box-shadow: var(--shadow);
  animation: slide-in 180ms ease-out;
}
.drawer-card .ghost { background: #efe8d8; color: var(--ink); }
.drawer-card .primary { background: var(--green); color: white; width: 100%; margin-top: 8px; }
.hint { color: var(--muted); font-size: 14px; }
.import-table { font-size: 13px; }
.import-table tr.bad td { color: var(--red); }
.bulk-wrap { max-height: 58vh; }
.bulk-table thead th { position: sticky; top: 0; z-index: 1; }
.bulk-table input, .bulk-table select { width: 92px; min-height: 34px; padding: 6px; text-align: right; }
.bulk-table select { text-align: left; }
.bulk-table input[data-f="batch"] { text-align: left; width: 100px; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
#productAdmin { display: grid; grid-template-columns: 1fr; gap: 12px; }
#orderList { display: grid; grid-template-columns: 1fr; gap: 10px; }
.order { margin-bottom: 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 16, 0.5);
  display: grid;
  align-items: end;
  z-index: 20;
}
.sheet.hidden { display: none; }
.sheet-card {
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 18px;
  max-height: 88vh;
  overflow: auto;
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.18);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: var(--green-d);
  color: white;
  padding: 11px 18px;
  border-radius: 999px;
  z-index: 30;
  box-shadow: 0 6px 20px rgba(20, 53, 43, 0.35);
  font-weight: 600;
}
.toast.hidden { display: none; }
@media (max-width: 699px) {
  body.step-confirm .toast { bottom: 168px; }
}
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: linear-gradient(180deg, #f8f2e4, #f4ecd9); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.stat b { display: block; font-size: 20px; margin-top: 3px; color: var(--green-d); }
.stat small { color: var(--muted); }
#reportStats { grid-template-columns: 1fr 1fr; }
h3 { margin: 12px 0 8px; font-size: 15px; color: var(--muted); }
.rowbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.due { color: var(--red); font-weight: 700; }
.goods-nav-anchor { min-height: 78px; margin-top: 16px; }
.goods-nav { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: var(--card); border: 1px solid #c9d7c5; border-radius: 14px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom,0px)); box-shadow: 0 -5px 22px rgba(20,53,43,0.08); }
.goods-nav.floating { position: fixed; bottom: 0; z-index: 15; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.goods-nav-summary { display: grid; gap: 4px; min-width: 0; }
.goods-nav-summary strong { color: var(--green-d); font-size: 14px; }
.goods-nav-summary span { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.goods-nav #toCart { width: auto; min-width: 200px; margin: 0; }
body.step-goods .toast { bottom: 100px; }
.customer-toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; margin: 12px 0; }
.customer-toolbar > label:first-child { flex: 1 1 300px; }
.customer-toolbar .check { margin-bottom: 18px; }
#addCustomer { width: auto; padding: 9px 16px; }
.customer-card { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: white; margin-top: 10px; }
.customer-card.archived { background: #f5f3ef; }
.customer-main { min-width: 0; }
.customer-main > strong { font-size: 17px; color: var(--green-d); overflow-wrap: anywhere; }
.customer-contact { margin-top: 5px; font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.customer-stats { color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.5; }
.customer-main .hint { margin: 6px 0 0; }
.customer-actions { display: flex; flex-wrap: wrap; gap: 8px; flex: 0 0 auto; }
.customer-actions .ghost { min-height: 40px; }
.customer-delete { color: var(--red); }
.customer-detail-head { display: grid; gap: 5px; padding: 14px 0; }
.customer-detail-head strong { font-size: 22px; color: var(--green-d); }
.customer-detail-head span { font-size: 16px; }
.customer-detail-head small { color: var(--muted); }
.customer-overview { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 10px 0 16px; }
.customer-overview > div { padding: 12px; background: #f0f5ec; border: 1px solid #d5e0cf; border-radius: 12px; }
.customer-overview span { display: block; font-size: 12px; color: var(--muted); }
.customer-overview b { display: block; font-size: 18px; margin: 6px 0; overflow-wrap: anywhere; }
.customer-overview small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.customer-order { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 14px; margin: 12px 0; }
.customer-order-meta { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 8px 0; }
.customer-order-item { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 12px; font-size: 13px; padding: 9px 0; border-top: 1px dotted var(--line); }
.customer-order-item > span { overflow-wrap: anywhere; }
.customer-order-item small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.customer-order-item b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.customer-order-item.in { color: var(--red); }
.customer-order-money { font-size: 13px; line-height: 1.7; margin: 6px 0 10px; }
.customer-sheet .sheet-card { width: min(960px,100%); }
@media (min-width:700px) {
  .customer-sheet { align-items: center; justify-items: center; padding: 24px; }
  .customer-sheet .sheet-card { border-radius: 18px; }
}
@media (max-width:699px) {
  .goods-nav { padding: 10px 12px calc(10px + env(safe-area-inset-bottom,0px)); gap: 10px; }
  .goods-nav #toCart { min-width: 150px; font-size: 14px; }
  .customer-card { display: block; padding: 14px; }
  .customer-actions { margin-top: 12px; }
  .customer-actions .ghost { flex: 1; padding: 8px 10px; }
  .customer-overview { grid-template-columns: 1fr; }
  .customer-order-item { gap: 8px; }
}
.tag.low { background: #f8d9d4; color: var(--red); }
.confirm-text { font-size: 15px; }
.confirm-text ~ .row2 { margin-top: 8px; }
.confirm-text ~ .row2 .ghost { background: #efe8d8; color: var(--ink); }
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 10, 0.92);
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 20px;
}
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 10px; object-fit: contain; }
.lb-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: white;
  font-size: 22px;
  z-index: 41;
}
button:disabled { opacity: 0.55; pointer-events: none; }
button { transition: opacity 120ms ease, transform 60ms ease, box-shadow 120ms ease; }
@media (max-width: 699px) {
  .pcard .actions, .plist-row .actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .row3, .row2 { grid-template-columns: 1fr; }
  .plist, #productAdmin, #orderList { grid-template-columns: 1fr; }
  .settle { margin-top: 0; }
  .tabs { padding: 8px; }
  .tabs button { flex: 1 1 30%; min-width: 0; font-size: 13px; padding: 8px 4px; }
  body.is-staff .tabs button { flex-basis: 48%; }
  body.is-staff [data-tab="entry"] { flex-basis: 100%; }
  .langs button { padding: 6px 7px; }
  .line { grid-template-columns: minmax(0, 1fr); }
  .drawer { grid-template-columns: 1fr; }
  .drawer-mask { display: none; }
  .amt input, .qty input { width: 100%; max-width: 120px; }
  #cart .qty input { width: 64px; }
  #cart .line, #cart .line.no-thumb { grid-template-columns: minmax(0, 1fr) 80px; }
  #cart .cart-info { grid-column: 1; }
  #cart .amt { grid-column: 2; grid-row: 1 / span 2; }
  #cart .cart-thumb { width: 48px; height: 48px; }
  .tool-row { display: grid; grid-template-columns: auto 1fr auto; }
  .tool-row .primary { grid-column: 1 / -1; grid-row: 2; }
}
@media (min-width: 700px) and (max-width: 1099px) {
  main { max-width: 920px; }
  .plist, #productAdmin, #orderList { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .ci-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid .kind-list, .form-grid #returnHint, .form-grid #buyers, .form-grid #dayHint, .form-grid #toGoods { grid-column: 1 / -1; }
  .row3 { grid-template-columns: 1fr 1fr 1fr; }
  #panel-orders .row3 { grid-template-columns: 1fr 1fr; }
  #panel-orders #reloadOrders { grid-column: 1 / -1; width: 100%; min-height: 44px; }
  .ptable td.ops, .ptable th.ops { position: sticky; right: 0; z-index: 1; box-shadow: -8px 0 8px rgba(28, 36, 22, 0.04); }
  .ptable th.ops { background: #f6f0e2; }
  .ptable td.ops { background: #fff; }
  .sheet { align-items: center; justify-items: center; padding: 24px; }
  .sheet-card { border-radius: 20px; width: min(560px, 100%); max-height: 84vh; }
  #reportStats { grid-template-columns: repeat(4, 1fr); }
  .tool-row { display: grid; grid-template-columns: auto 1fr auto; }
  .tool-row .primary { grid-column: 1 / -1; grid-row: 2; }
}
@media (min-width: 1100px) {
  main { max-width: none; padding: 16px 24px 32px; }
  .stats.global-stats { margin-bottom: 12px; grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .plist { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #productAdmin { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #orderList { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(6, 1fr); margin-bottom: 12px; }
  .pcard img, .pcard .ph { height: 150px; }
  .split { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 12px; align-items: start; }
  .drawer { grid-template-columns: 1fr 480px; }
  .steps { max-width: 520px; margin: 0 auto 10px; }
  .form-grid { grid-template-columns: 1fr 1fr 1fr; }
  .ci-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid .kind-list, .form-grid #returnHint, .form-grid #buyers, .form-grid #dayHint, .form-grid #toGoods { grid-column: 1 / -1; }
  .form-grid .kind-list { max-width: 640px; }
  .form-grid #toGoods { max-width: 360px; justify-self: end; }
  .goods-layout { display: grid; grid-template-columns: 1fr; gap: 12px; }
  .goods-side { position: static; align-self: auto; }
  .goods-layout #filterToggle { display: none; }
  .goods-layout #filters.pick { display: flex; flex-direction: column; gap: 10px; margin: 0; }
  #toCart { max-width: 360px; margin-left: auto; }
  .confirm-grid { grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; align-items: start; }
  #cart .line { padding: 14px 0; gap: 14px; }
  #cart .qty { margin-top: 8px; }
  #cart .line-note { margin-top: 10px; }
  .confirm-info .ci-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(200px, 0.65fr); }
  #panel-orders > .card .row3 { grid-template-columns: 180px 160px minmax(0, 1fr) auto; align-items: end; }
  #panel-orders #reloadOrders { width: auto; min-width: 88px; margin-bottom: 8px; height: 44px; }
  #panel-logs { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr); gap: 12px; align-items: start; }
  #reportStats { grid-template-columns: repeat(4, 1fr); }
  #panel-logs .card { margin-bottom: 0; }
  #panel-logs .kind-list { grid-template-columns: repeat(5, 140px); }
  .tool-row { justify-content: flex-start; }
  .ptable-wrap { max-width: none; }
}

/* 订单导出 PDF：printArea 平时隐藏；body.printing 时打印输出只含它 */
#printArea { display: none; }
@page { margin: 12mm; }
@media print {
  body.printing > *:not(#printArea) { display: none !important; }
  body.printing #printArea { display: block; }
  #printArea { display: block; color: #000; background: #fff; }
}
#printArea .p-head { border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 10px; }
#printArea .p-head h1 { margin: 0; font-size: 22px; }
#printArea .p-tags { font-size: 12px; margin-top: 4px; }
#printArea .p-party { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 10px 0; }
#printArea .p-party small { display: block; color: #444; font-size: 11px; }
#printArea .p-party b { font-size: 14px; }
#printArea .p-items { width: 100%; border-collapse: collapse; margin: 8px 0; }
#printArea .p-items th, #printArea .p-items td { border: 1px solid #888; padding: 5px 8px; font-size: 12px; text-align: left; vertical-align: top; }
#printArea .p-items th { background: #efefef; }
#printArea .p-items .num { text-align: right; white-space: nowrap; }
#printArea .p-items small { color: #444; font-weight: 400; }
#printArea .p-items small.fac { color: #7a5410; margin-left: 4px; font-weight: 700; }
#printArea .p-bill { margin: 10px 0 0 auto; max-width: 65%; }
#printArea .p-bill div { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; border-bottom: 1px dashed #aaa; font-size: 12.5px; }
#printArea .p-bill b { white-space: nowrap; }
#printArea .p-bill .due b { color: #a33b32; }
#printArea .p-note { font-size: 12.5px; margin: 12px 0; }
#printArea .p-slips { margin-top: 12px; }
#printArea .p-slips > small { color: #444; }
#printArea .p-slips > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
#printArea .p-slips img { width: 100%; border: 1px solid #888; break-inside: avoid; }
#printArea .p-foot { margin-top: 14px; padding-top: 6px; border-top: 1px solid #999; font-size: 11px; color: #444; }

/* 客户单据：打印时采用纸质发票的七列表格。 */
#printArea .inv { page: customer-invoice; color: #000; font: 12px/1.45 Arial, "Microsoft YaHei", sans-serif; }
@page customer-invoice { size: A4; margin: 12mm; }
#printArea .inv-brand { text-align: center; margin-bottom: 22px; }
#printArea .inv-brand h2 { margin: 0 0 4px; font-size: 21px; letter-spacing: 0; overflow-wrap: anywhere; }
#printArea .inv-brand h2::after { content: none; }
#printArea .inv-contact { font-size: 11.5px; white-space: pre-line; overflow-wrap: anywhere; }
#printArea .inv-title { text-align: center; font-size: 15px; font-weight: 700; margin-bottom: 10px; }
/* 客户信息行放在商品表 thead 内（thead 打印时每页重复），无边框、不套列宽，视觉与原独立表格一致 */
#printArea .inv-items thead .inv-party-cell { border: 0; padding: 0 0 12px; text-align: left; font-weight: 400; vertical-align: top; font-size: 12px; overflow-wrap: anywhere; }
#printArea .inv-items thead .inv-meta-cell { border: 0; padding: 0 0 12px 16px; text-align: right; font-weight: 400; vertical-align: top; font-size: 12px; }
#printArea .inv-items thead .inv-party-cell b { display: block; font-size: 13px; }
#printArea .inv-items thead .inv-party-cell .inv-ref { margin-top: 8px; }
#printArea .inv-items { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 0 auto; }
#printArea .inv-items thead { display: table-header-group; }
#printArea .inv-items tr { break-inside: avoid; }
/* 末尾商品、结算和签名必须一起换页，避免留下只有合计的尾页。 */
#printArea .inv-ending { break-inside: avoid; page-break-inside: avoid; }
#printArea .inv-items th, #printArea .inv-items td { border: 0.6px solid #b8b8b8; padding: 5px 5px; font-size: 11px; vertical-align: top; font-weight: 400; overflow-wrap: anywhere; }
#printArea .inv-items th { text-align: center; color: #000; background: #fff; font-weight: 700; }
#printArea .inv-items .inv-desc-head { text-align: left; }
#printArea .inv-items .num { text-align: right; font-variant-numeric: tabular-nums; }
#printArea .inv-items .inv-sl { text-align: center; }
#printArea .inv-items .inv-unit { text-align: center; }
#printArea .inv-items .inv-desc small { display: block; font-size: 10.5px; margin-top: 2px; color: #222; }
#printArea .inv-items .empty { text-align: center; }
#printArea .inv-items .inv-summary-label { text-align: right; }
#printArea .inv-items .inv-total td { font-weight: 700; }
#printArea .inv-items .inv-grand td { font-size: 12px; font-weight: 700; border-top: 1px solid #777; }
#printArea .inv-items .inv-footer-cell { border: 0; padding: 0; font-size: 12px; }
#printArea .inv-words { margin-top: 10px; font-size: 12px; overflow-wrap: anywhere; }
#printArea .inv-balance { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px 18px; margin-top: 7px; font-size: 11.5px; }
#printArea .inv-narr { margin-top: 10px; font-size: 12px; white-space: pre-line; overflow-wrap: anywhere; }
#printArea .inv-sign { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-top: 24px; break-inside: avoid; }
#printArea .inv-sign .sig-l { width: 30%; text-align: center; }
#printArea .inv-sign .sig-r { width: 40%; text-align: center; }
#printArea .inv-sign b { display: block; font-size: 12px; overflow-wrap: anywhere; }
#printArea .inv-sign small { display: block; border-top: 0.8px solid #000; padding-top: 3px; margin-top: 36px; font-size: 11.5px; }
#printArea .inv-decl { margin-top: 22px; font-size: 11.5px; white-space: pre-line; overflow-wrap: anywhere; break-inside: avoid; }
.invoice-settings-card { grid-column: 1 / -1; }
#invoiceSettingsForm { max-width: 900px; }
#invoiceSettingsForm textarea { resize: vertical; }
@media print {
  body.printing { margin: 0; padding: 0; background: #fff; }
  body.printing #printArea { margin: 0; padding: 0; }
}

/* 凭证链：退货/换货关联原始销售单 */
.ref-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ref-picked { display: inline-flex; align-items: center; gap: 6px; background: #e4efe8; border: 1px solid var(--green-d); border-radius: 10px; padding: 6px 10px; font-size: 13px; }
.ref-picked b { color: var(--green-d); }
.ref-picked .prev-x { border: 0; background: transparent; font-size: 16px; line-height: 1; cursor: pointer; color: var(--muted); }
.ref-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ref-line-main { min-width: 0; }
.ref-line-main small { color: var(--muted); display: block; }
.ref-line-items small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.tag.ref { background: #e8e4f4; color: #4a3b8a; font-weight: 600; }
#refBox { margin: 6px 0; }
.order-review-received.refund b { color: #a33b32; }

/* 退款单（退多买少）：结算面板退款区 */
#refundBox .refund-amt { color: #a33b32; }

/* 库存流水行内的订单号（可点开订单） */
.link-like { border: 0; background: transparent; color: var(--green-d); text-decoration: underline; padding: 0 2px; font-size: 13px; cursor: pointer; }

/* 管理页二级分区导航 + 库存筛选（管理页整体单列：导航、分区、卡片顺排） */
#panel-logs { display: block; }
.admin-subnav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.admin-subnav button { border: 1px solid var(--line-strong); background: #f6f0e2; color: var(--ink); border-radius: 999px; min-height: 38px; padding: 6px 18px; font-size: 14px; }
.admin-subnav button.on { background: var(--green); color: #fff; border-color: var(--green); font-weight: 700; }
.move-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 8px 0 12px; }

/* 订单筛选汇总栏：跨分页的合计 */
.order-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 20px; padding: 10px 14px; margin: 10px 0; background: #f6f0e2; border: 1px solid var(--line-strong); border-radius: 12px; font-size: 13.5px; color: var(--ink); }
.order-summary-count { margin-right: auto; }
.order-summary-metric { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.order-summary b { font-size: 15px; font-variant-numeric: tabular-nums; }
.order-summary b.received { color: var(--green-d); }
.order-summary b.due { color: #a33b32; }
.order-summary-hint { flex-basis: 100%; color: var(--muted); line-height: 1.6; }

/* 厂号和商品共享明细行；整单字段跨行，金额不会按商品重复累计。 */
.otable { min-width: 1580px; }
.otable .ofac-cell { width: 90px; min-width: 90px; padding: 3px 10px; white-space: nowrap; }
.otable .oitems-cell { width: 22%; min-width: 240px; padding: 3px 10px; }
.otable .ofac-line, .otable .oitems-cell .oi-code { display: block; min-height: 26px; line-height: 22px; padding: 2px 0; font-size: 13px; white-space: nowrap; }
.otable .ofac-line .tag.fac { margin: 0; padding: 0 7px; line-height: 20px; }
.otable .order-direction-cell { min-width: 76px; padding: 5px 10px; white-space: nowrap; }
.otable th.order-item-qty, .otable td.order-item-qty, .otable th.order-item-amount, .otable td.order-item-amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.otable td.order-item-qty, .otable td.order-item-amount { padding: 5px 10px; line-height: 22px; font-size: 13px; }
.otable .order-item-amount { min-width: 90px; }
.otable .incoming { color: var(--red); }
.otable .order-item-continuation td { border-top: 0; }
.otable th.order-money, .otable td.order-money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.otable .order-received b { color: var(--green-d); }
.order-direction { display: inline-block; border-radius: 6px; padding: 1px 6px; font-size: 11px; line-height: 20px; white-space: nowrap; vertical-align: middle; }
.order-direction.in { color: var(--red); background: #f8e7e3; }
.order-direction.out { color: var(--green-d); background: #e4efe8; }
.order-direction-hint { margin: 8px 0 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.order-mobile-head, .order-detail-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) 28px 78px; gap: 6px; }
.order-mobile-head { padding: 4px 0; font-size: 11px; color: var(--muted); }
.order-detail-row { align-items: center; border-bottom: 1px dotted var(--line); padding: 5px 0; font-size: 12px; }
.order-detail-row .ofac-line { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-detail-row .ofac-line .tag.fac { margin: 0; padding: 1px 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.order-mobile-product { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; gap: 2px; }
.order-mobile-product .oi-code { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-mobile-items .oi-qty, .order-mobile-items .oi-amt { text-align: right; font-variant-numeric: tabular-nums; }
.order-detail-row .oi-qty, .order-detail-row .oi-amt { white-space: nowrap; }
.order-detail-row.in .oi-code, .order-detail-row.in .oi-amt { color: var(--red); }
.order-row-totals { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 16px; }
.order-row-totals > span { display: grid; gap: 2px; }
.order-row-totals small { color: var(--muted); font-size: 11px; }
@media (max-width: 699px) {
  .orow-side { flex-wrap: wrap; }
  .order-row-totals { flex: 1 0 100%; justify-content: flex-start; text-align: left; }
  .order-row-totals > span { flex: 1; }
}

/* 修改原因输入（核对弹窗）与日志原因显示 */
.review-reason { display: block; margin: 10px 0 4px; }
.review-reason span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.review-reason input { width: 100%; }
.log-row .log-reason { display: block; color: #8a5a10; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Product video: separate playback from image zoom and keep each overlay's scroll inside its card. */
body.product-video-modal-open { overflow: hidden; }
.product-video-play { color: var(--green-d); border-color: var(--green); background: #e9f4ed; min-height: 44px; padding: 7px 12px; font-size: 13px; width: fit-content; max-width: 100%; align-self: flex-start; margin-top: 6px; }
.product-video-play.product-video-icon-button { display: inline-grid; place-items: center; width: 44px; height: 44px; min-height: 44px; max-width: 44px; padding: 0; border-radius: 50%; }
.product-video-glyph { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; pointer-events: none; }
.product-video-icon { width: 24px; height: 24px; pointer-events: none; }
.product-video-play.product-video-thumbnail { position: relative; width: 112px; height: 64px; min-height: 64px; max-width: 112px; border-radius: 9px; overflow: hidden; border-color: #b9cbbf; background: #eef3ef; }
.product-video-play img[data-video-preview] { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; border: 0; border-radius: 0; opacity: 0; background: #14211b; pointer-events: none; }
.product-video-thumbnail .product-video-glyph { position: relative; z-index: 1; background: #e9f4ed; border: 1px solid var(--green); }
.product-video-thumbnail.is-preview-ready img[data-video-preview] { opacity: 1; }
.product-video-thumbnail.is-preview-ready .product-video-glyph { width: 32px; height: 32px; color: white; border-color: rgba(255, 255, 255, 0.85); background: rgba(12, 24, 19, 0.72); box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25); }
.product-video-thumbnail.is-preview-ready .product-video-icon { width: 19px; height: 19px; }
.prow.has-video { grid-template-columns: 64px minmax(0, 1fr) 80px; grid-template-areas: "photo info video" "quantity quantity quantity"; }
.prow > .goods-video-play { grid-area: video; align-self: center; justify-self: start; margin: 0; }
@media (min-width: 600px) {
  .prow.has-video { grid-template-columns: 64px minmax(0, 1fr) minmax(112px, 28%); }
}
@media (max-width: 599px) {
  .product-video-play.product-video-thumbnail { width: 80px; height: 54px; min-height: 54px; max-width: 80px; }
}
@media (max-width: 379px) {
  .prow.has-video { grid-template-columns: 64px minmax(0, 1fr) 72px; }
  .product-video-play.product-video-thumbnail { width: 72px; max-width: 72px; }
}
.pcard .actions, .plist-row .actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pcard .actions button, .plist-row .actions button { white-space: normal; overflow-wrap: anywhere; }
.product-video-layer { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(12, 24, 19, 0.78); padding: max(16px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); overscroll-behavior: contain; }
.product-video-manager { z-index: 60; }
.sheet.product-video-confirm { z-index: 65; }
.product-video-player { z-index: 70; }
.product-video-card { width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 16px 56px rgba(0, 0, 0, 0.3); min-width: 0; }
.product-video-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.product-video-header h2 { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.product-video-close { flex: 0 0 auto; width: 44px; min-height: 44px; padding: 4px; font-size: 24px; line-height: 1; }
.product-video-current { border: 1px solid var(--line); background: #f4f1e9; border-radius: 12px; padding: 12px; margin-bottom: 16px; }
.product-video-current p, .product-video-selected { overflow-wrap: anywhere; font-size: 13px; margin: 8px 0; line-height: 1.6; }
.product-video-selected:empty, .product-video-job .msg:empty { display: none; }
.product-video-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.product-video-actions .ghost { margin: 0; min-height: 40px; white-space: normal; }
.product-video-delete { color: var(--red); border-color: #d9aba5; }
.product-video-created { border: 1px solid #a4cbb1; background: #e9f4ed; color: var(--green-d); border-radius: 10px; padding: 10px; line-height: 1.6; }
.product-video-select input { max-width: 100%; font-size: 14px; }
.product-video-card .hint { line-height: 1.6; }
.product-video-card button:disabled { opacity: 0.5; cursor: default; }
.product-video-job .msg { line-height: 1.6; overflow-wrap: anywhere; }
.product-video-progress { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.product-video-progress progress { flex: 1; width: 100%; min-width: 0; height: 12px; accent-color: var(--green); }
.product-video-progress span { min-width: 3em; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.product-video-player .product-video-card { width: min(960px, 100%); background: #14211b; color: #f7f5ee; border-color: #30483b; }
.product-video-player .product-video-header h2::after { display: none; }
.product-video-player video { display: block; width: 100%; min-height: 150px; max-height: min(66dvh, 680px); background: #000; border-radius: 10px; object-fit: contain; }
.product-video-player-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.product-video-player-footer p { flex: 1 1 220px; font-size: 13px; line-height: 1.6; margin: 0; }
.product-video-player-footer button { min-height: 44px; }
.product-video-layer video:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
@media (max-width: 599px) {
  .product-video-layer { padding: max(10px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .product-video-card { padding: 14px; border-radius: 14px; max-height: calc(100dvh - 20px); }
  .product-video-player video { max-height: 62dvh; }
  .product-video-header h2 { font-size: 16px; }
  .product-video-card > .primary { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { .product-video-layer * { scroll-behavior: auto; } }
@media print { .product-video-layer, .product-video-play, [data-product-video-manage] { display: none !important; } }

/* 经营报表：工具栏 + 动态刷新 + TV 模式（科技感数据大屏风格，仅作用于 .tv 遮罩内） */
.report-tools { align-items: center; }
.report-tools input[type="month"] { width: auto; }
#reportUpdated { font-variant-numeric: tabular-nums; min-height: 1em; }
.tv {
  --tv-cyan: #29d8ff;
  --tv-cyan-soft: rgba(41, 216, 255, 0.55);
  --tv-blue: #3f7cff;
  --tv-line: rgba(64, 156, 225, 0.4);
  --tv-panel: linear-gradient(180deg, rgba(18, 52, 96, 0.55), rgba(10, 28, 58, 0.65));
  --tv-glow: 0 0 22px rgba(41, 216, 255, 0.18), inset 0 0 26px rgba(24, 84, 158, 0.16);
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.6vh, 18px);
  padding: clamp(12px, 2vw, 34px) clamp(14px, 2.2vw, 40px);
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(37, 99, 190, 0.32), transparent 65%),
    radial-gradient(900px 420px at 8% 108%, rgba(24, 84, 158, 0.3), transparent 60%),
    radial-gradient(900px 420px at 92% 108%, rgba(24, 84, 158, 0.26), transparent 60%),
    linear-gradient(180deg, #071a38 0%, #061430 55%, #041026 100%);
  color: #d8ecff;
  overflow: auto;
  overscroll-behavior: contain;
  font-variant-numeric: tabular-nums;
}
.tv::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(64, 156, 225, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(64, 156, 225, 0.055) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.9), rgba(0,0,0,0.35) 30%, rgba(0,0,0,0.15) 70%, rgba(0,0,0,0.5));
}
.tv.hidden { display: none; }
body.tv-on { overflow: hidden; }

/* 头部：左侧时钟 + 中央标题 + 斜切装饰线 */
.tv-head { position: relative; display: grid; grid-template-columns: 1fr minmax(0, 2.2fr) 1fr; align-items: center; gap: 12px; min-height: clamp(52px, 8vh, 88px); }
.tv-head-clock { grid-column: 1; color: #7dffc8; font-size: clamp(18px, 2vw, 32px); font-weight: 700; letter-spacing: 2px; text-shadow: 0 0 14px rgba(77, 255, 195, 0.45); white-space: nowrap; }
.tv-head-clock > small { display: block; color: #8fc6ea; font-size: clamp(10px, 0.95vw, 14px); font-weight: 400; letter-spacing: 1px; margin-top: 2px; }
.tv-head::before, .tv-head::after {
  content: "";
  align-self: center;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--tv-cyan) 45%, transparent);
  box-shadow: 0 0 12px var(--tv-cyan-soft);
}
.tv-head::before { transform: skewY(-1.2deg); }
.tv-head::after { transform: skewY(1.2deg); }
.tv-head > strong {
  grid-column: 2;
  text-align: center;
  font-size: clamp(22px, 2.9vw, 44px);
  letter-spacing: clamp(2px, 0.4vw, 8px);
  color: #eafaff;
  text-shadow: 0 0 18px rgba(41, 216, 255, 0.55), 0 0 46px rgba(41, 216, 255, 0.25);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tv-head-side { grid-column: 3; display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.tv-head-side > small { display: inline-flex; align-items: center; gap: 8px; color: #9fd4f6; font-size: clamp(12px, 1.15vw, 17px); white-space: nowrap; }
.tv-head-side > small::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4dffc3;
  box-shadow: 0 0 10px #4dffc3;
  animation: tvPulse 2.2s infinite;
}
@keyframes tvPulse {
  0% { box-shadow: 0 0 0 0 rgba(77, 255, 195, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(77, 255, 195, 0); }
  100% { box-shadow: 0 0 0 0 rgba(77, 255, 195, 0); }
}
.tv-exit { flex: 0 0 auto; min-width: 50px; min-height: 46px; padding: 4px 14px; border: 1px solid rgba(41, 216, 255, 0.5); background: rgba(16, 52, 96, 0.6); color: #bfe7ff; font-size: 12.5px; cursor: pointer; clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); transition: background 0.15s; }
.tv-exit:hover { background: rgba(41, 216, 255, 0.2); color: #fff; }

/* 统计卡：斜切边框 + 发光数字 */
.tv-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 1.2vw, 18px); }
.tv-stat {
  position: relative;
  background: var(--tv-panel);
  border: 1px solid var(--tv-line);
  box-shadow: var(--tv-glow);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  padding: clamp(10px, 1.8vh, 22px) clamp(14px, 1.4vw, 26px);
  min-width: 0;
}
.tv-stat::before {
  content: "";
  position: absolute;
  inset: 3px;
  pointer-events: none;
  background:
    linear-gradient(rgba(64, 156, 225, 0.1), transparent 28%),
    repeating-linear-gradient(90deg, transparent 0 6px, rgba(64, 156, 225, 0.03) 6px 7px);
}
.tv-stat > * { position: relative; }
.tv-stat small { display: block; color: #8fc6ea; font-size: clamp(13px, 1.3vw, 19px); letter-spacing: 1px; }
.tv-stat b { display: block; margin: clamp(4px, 0.8vh, 10px) 0 4px; font-size: clamp(26px, 3.2vw, 52px); line-height: 1.1; color: #eafaff; text-shadow: 0 0 16px rgba(41, 216, 255, 0.6), 0 0 40px rgba(41, 216, 255, 0.22); overflow-wrap: anywhere; }
.tv-stat.today { border-color: rgba(77, 255, 195, 0.55); }
.tv-stat.today b { color: #7dffc8; text-shadow: 0 0 16px rgba(77, 255, 195, 0.55), 0 0 40px rgba(77, 255, 195, 0.2); }
.tv-stat.today small { color: #7dd8b8; }
.tv-stat.all-time { border-color: rgba(255, 203, 107, 0.55); }
.tv-stat.all-time b { color: #ffd889; text-shadow: 0 0 16px rgba(255, 203, 107, 0.55), 0 0 40px rgba(255, 180, 60, 0.22); }
.tv-stat.all-time small { color: #e8cf9d; }

/* 主区：图表 + 右列 */
.tv-main { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: clamp(8px, 1.3vw, 20px); flex: 1; min-height: 0; }
.tv-side { display: flex; flex-direction: column; gap: clamp(8px, 1.3vw, 20px); min-height: 0; min-width: 0; }
#tvMonths { flex: 0 0 auto; }
#tvSales { flex: 1 1 0; }

/* 面板：科技边框 + 顶部流光线 + 角标 + 标题条 */
.tv-panel {
  position: relative;
  background: var(--tv-panel);
  border: 1px solid var(--tv-line);
  box-shadow: var(--tv-glow);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  padding: clamp(10px, 1.6vh, 20px) clamp(12px, 1.3vw, 24px);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tv-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--tv-cyan) 0%, transparent 42%, transparent 58%, var(--tv-cyan) 100%);
  opacity: 0.75;
}
.tv-panel::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 8px;
  width: 26px;
  height: 12px;
  border-top: 2px solid var(--tv-cyan);
  border-right: 2px solid var(--tv-cyan);
  opacity: 0.7;
}
.tv-panel > h3 {
  position: relative;
  margin: 0 0 clamp(6px, 1vh, 12px);
  padding-left: 12px;
  color: #bfe7ff;
  font-size: clamp(13px, 1.35vw, 19px);
  letter-spacing: 2px;
}
.tv-panel > h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) skewY(-12deg);
  width: 5px;
  height: 82%;
  background: linear-gradient(180deg, var(--tv-cyan), var(--tv-blue));
  box-shadow: 0 0 8px var(--tv-cyan-soft);
}
.report-chart { width: 100%; height: auto; display: block; }
#tvChart > .report-chart { flex: 1; min-height: 0; height: 100%; }

/* 销售记录列表 */
.tv-sales-list { overflow: auto; flex: 1; min-height: 0; scrollbar-width: thin; scrollbar-color: rgba(41, 216, 255, 0.4) transparent; }
.tv-sale-row { display: flex; align-items: baseline; gap: clamp(8px, 1vw, 16px); padding: clamp(5px, 1.05vh, 12px) 2px; border-bottom: 1px solid rgba(64, 156, 225, 0.16); }
.tv-sale-row:nth-child(odd) { background: rgba(24, 84, 158, 0.1); }
.tv-sale-row > small { color: #7fb3d8; font-size: clamp(11px, 1.05vw, 15px); white-space: nowrap; }
.tv-sale-buyer { flex: 1; min-width: 0; color: #d8ecff; font-size: clamp(13px, 1.3vw, 19px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-sale-row > b { color: #7dffc8; font-size: clamp(14px, 1.4vw, 21px); text-shadow: 0 0 10px rgba(77, 255, 195, 0.35); white-space: nowrap; }
.tv-sale-row .tag.tv-sale-kind { margin-left: 4px; font-size: clamp(9px, 0.85vw, 12px); padding: 0 6px; line-height: 16px; vertical-align: middle; }
.tv-sale-empty { color: #7fb3d8; padding: 14px 0; }

@media (max-width: 900px) {
  .tv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tv-main { grid-template-columns: 1fr; }
  .tv-head { grid-template-columns: 1fr auto; }
  .tv-head::before { display: none; }
  .tv-head-clock { display: none; }
  .tv-head > strong { grid-column: 1; text-align: left; white-space: normal; }
  .tv-head-side { grid-column: 2; }
}
