/* ================= 基础 ================= */
:root {
  --blue: #1f5fd8;
  --blue-d: #17469f;
  --blue-l: #eaf1fe;
  --bg: #f1f4f9;
  --card: #ffffff;
  --text: #161b23;
  --text2: #4b5566;
  --muted: #8b94a5;
  --line: #e9edf4;
  --red: #dd3f36;
  --red-l: #fdecea;
  --green: #0f9d63;
  --green-l: #e7f7f0;
  --amber: #d98511;
  --amber-l: #fdf4e3;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 18px rgba(16, 24, 40, 0.05);
  --nav-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior-y: none;
}
input,
textarea,
select,
button {
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
}
a {
  color: var(--blue);
  text-decoration: none;
}
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}
.hide {
  display: none !important;
}

/* ================= 框架 ================= */
#app {
  min-height: 100%;
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg);
}
#topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 0 4px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
#topbar .tb-title {
  font-size: 16.5px;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#topbar .tb-btn {
  min-width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: 0;
  color: var(--blue);
  font-size: 14.5px;
  padding: 0 10px;
  border-radius: 10px;
}
#topbar .tb-btn:active {
  background: var(--blue-l);
}
#topbar .icon {
  font-size: 20px;
  line-height: 1;
}

#view {
  padding: 12px 12px calc(var(--nav-h) + var(--safe-b) + 18px);
}

#tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  max-width: 720px;
  margin: 0 auto;
}
#tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
}
#tabbar a .ti {
  font-size: 21px;
  line-height: 1;
}
#tabbar a.on {
  color: var(--blue);
  font-weight: 600;
}

/* ================= 通用组件 ================= */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}
.card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px 0;
}
.card-hd h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
}
.card-bd {
  padding: 12px 14px;
}
.sec-title {
  font-size: 13px;
  color: var(--muted);
  margin: 16px 4px 8px;
  font-weight: 500;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn:active {
  transform: scale(0.985);
  background: #f6f8fc;
}
.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 4px 12px rgba(31, 95, 216, 0.24);
}
.btn-primary:active {
  background: var(--blue-d);
}
.btn-danger {
  color: var(--red);
  border-color: #f6d5d2;
  background: #fff;
}
.btn-block {
  display: flex;
  width: 100%;
}
.btn-sm {
  height: 34px;
  padding: 0 11px;
  font-size: 13.5px;
  border-radius: 9px;
}
.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.seg {
  display: flex;
  background: #e9edf4;
  border-radius: 11px;
  padding: 3px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar {
  display: none;
}
.seg button {
  flex: 1;
  min-width: 62px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--text2);
  font-size: 14px;
  border-radius: 9px;
  white-space: nowrap;
}
.seg button.on {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.1);
}

.field {
  margin-bottom: 12px;
}
.field label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 5px;
  padding-left: 2px;
}
.input,
textarea.input,
select.input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 11px;
  padding: 0 12px;
  outline: none;
  transition: 0.15s;
}
textarea.input {
  height: auto;
  min-height: 74px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.55;
}
.input:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 95, 216, 0.1);
}
.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.row3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.search {
  position: relative;
  margin-bottom: 10px;
}
.search input {
  width: 100%;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 14px 0 36px;
  outline: none;
}
.search .si {
  position: absolute;
  left: 12px;
  top: 11px;
  color: var(--muted);
  font-size: 16px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar {
  display: none;
}
.chip {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 12px;
  border-radius: 15px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text2);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
}
.chip.on {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.badge {
  display: inline-block;
  padding: 1.5px 7px;
  border-radius: 6px;
  font-size: 11.5px;
  line-height: 1.55;
  background: #eef1f6;
  color: var(--text2);
  white-space: nowrap;
}
.badge.g {
  background: var(--green-l);
  color: var(--green);
}
.badge.r {
  background: var(--red-l);
  color: var(--red);
}
.badge.a {
  background: var(--amber-l);
  color: var(--amber);
}
.badge.b {
  background: var(--blue-l);
  color: var(--blue);
}

.li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.li:last-child {
  border-bottom: 0;
}
.li:active {
  background: #f8fafc;
}
.li-main {
  flex: 1;
  min-width: 0;
}
.li-t {
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.li-s {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.li-r {
  text-align: right;
  flex: 0 0 auto;
}
.li-amount {
  font-size: 15.5px;
  font-weight: 600;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 14px;
}
.empty .ei {
  font-size: 34px;
  display: block;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* ================= 首页 ================= */
.hero {
  background: linear-gradient(135deg, #1f5fd8, #2f7bee 60%, #3f8bf5);
  color: #fff;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 8px 22px rgba(31, 95, 216, 0.26);
}
.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  opacity: 0.9;
}
.hero-num {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 6px 0 2px;
}
.hero-sub {
  display: flex;
  gap: 22px;
  font-size: 12.5px;
  opacity: 0.92;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
}
.hero-sub b {
  font-size: 15px;
  font-weight: 600;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.stat {
  background: #fff;
  border-radius: var(--radius);
  padding: 13px 14px;
  box-shadow: var(--shadow);
}
.stat .sl {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat .sv {
  font-size: 21px;
  font-weight: 650;
  margin-top: 4px;
  letter-spacing: -0.3px;
}
.stat .sv small {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 3px;
}

.quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: #fff;
  border-radius: var(--radius);
  padding: 12px 6px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.quick a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 2px;
  color: var(--text);
  font-size: 12px;
  text-decoration: none;
  border-radius: 10px;
}
.quick a:active {
  background: var(--blue-l);
}
.quick .qi {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  background: var(--blue-l);
  color: var(--blue);
}
.quick .qi.g {
  background: var(--green-l);
  color: var(--green);
}
.quick .qi.a {
  background: var(--amber-l);
  color: var(--amber);
}
.quick .qi.r {
  background: var(--red-l);
  color: var(--red);
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 92px;
  padding: 6px 2px 0;
}
.bars .b {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
}
.bars .b i {
  display: block;
  width: 100%;
  max-width: 26px;
  background: linear-gradient(180deg, #6fa3f8, #1f5fd8);
  border-radius: 5px 5px 2px 2px;
  min-height: 3px;
  transition: height 0.4s;
}
.bars .b span {
  font-size: 10.5px;
  color: var(--muted);
}

/* ================= 扫码 ================= */
.scan-input {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1.5px solid var(--blue);
  border-radius: 13px;
  padding: 4px 6px 4px 12px;
  box-shadow: 0 0 0 4px rgba(31, 95, 216, 0.08);
  margin-bottom: 12px;
}
.scan-input input {
  flex: 1;
  border: 0;
  outline: none;
  background: none;
  height: 38px;
  font-size: 15px;
}
.scan-input .cam {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 0;
  background: var(--blue);
  color: #fff;
  font-size: 18px;
}

#scan-root {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: none;
}
#scan-root.on {
  display: block;
}
#scan-root video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scan-frame {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  width: 74%;
  height: 108px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.42);
}
.scan-frame:after {
  content: '';
  position: absolute;
  left: 6%;
  right: 6%;
  top: 50%;
  height: 2px;
  background: #ff4d4f;
  box-shadow: 0 0 10px #ff4d4f;
  animation: scanline 2s ease-in-out infinite;
}
@keyframes scanline {
  0%,
  100% {
    transform: translateY(-42px);
  }
  50% {
    transform: translateY(42px);
  }
}
.scan-tip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 110px;
  text-align: center;
  color: #fff;
  font-size: 13.5px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  padding: 0 24px;
}
.scan-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 19px;
}
.scan-manual {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(34px + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 8px;
}
.scan-manual input {
  flex: 1;
  height: 44px;
  border-radius: 11px;
  border: 0;
  background: rgba(255, 255, 255, 0.95);
  padding: 0 12px;
}
.scan-manual button {
  height: 44px;
  padding: 0 16px;
  border-radius: 11px;
  border: 0;
  background: var(--blue);
  color: #fff;
}

/* ================= 提示 / 弹层 ================= */
#toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(20, 24, 32, 0.9);
  color: #fff;
  padding: 11px 18px;
  border-radius: 11px;
  font-size: 14px;
  max-width: 78vw;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 500;
  line-height: 1.45;
}
#toast.on {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

#modal-root {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
}
#modal-root.on {
  display: block;
}
.mask {
  position: absolute;
  inset: 0;
  background: rgba(16, 20, 28, 0.45);
  animation: fade 0.18s;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + var(--safe-b));
  max-height: 88vh;
  overflow-y: auto;
  animation: up 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes up {
  from {
    transform: translateY(40px);
    opacity: 0.6;
  }
}
.sheet-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.sheet-hd h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}
.sheet-x {
  width: 34px;
  height: 34px;
  border: 0;
  background: #f2f4f8;
  border-radius: 50%;
  font-size: 17px;
  color: var(--text2);
}
.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.sheet-actions .btn {
  flex: 1;
}
.picker-li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}
.picker-li:active {
  background: #f8fafc;
}

/* ================= 明细行 / 底部操作条 ================= */
.item-line {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.item-line:last-child {
  border-bottom: 0;
}
.il-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 500;
}
.il-top .il-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.il-mid {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 6px;
}
.il-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: #f8fafc;
}
.stepper button {
  width: 34px;
  height: 32px;
  border: 0;
  background: none;
  font-size: 17px;
  color: var(--text2);
}
.stepper button:active {
  background: #e9edf4;
}
.stepper input {
  width: 52px;
  height: 32px;
  border: 0;
  background: none;
  text-align: center;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}
.price-in {
  width: 82px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
  text-align: right;
  padding: 0 8px;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
.il-amt {
  font-weight: 600;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}
.il-del {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  color: var(--red);
  font-size: 13px;
  line-height: 1;
}
.il-del:active {
  background: var(--red-l);
}

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 720px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 10px 12px calc(10px + var(--safe-b));
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 10px;
}
.bottom-bar .bb-info {
  flex: 1;
  min-width: 0;
}
.bottom-bar .bb-info .bl {
  font-size: 11.5px;
  color: var(--muted);
}
.bottom-bar .bb-info .bv {
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.4px;
}
.bottom-bar .btn {
  min-width: 108px;
}
.pad-bottom {
  padding-bottom: calc(72px + var(--safe-b));
}

.total-line {
  display: flex;
  justify-content: space-between;
  padding: 7px 14px;
  font-size: 14px;
  color: var(--text2);
}
.total-line.big {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  padding-top: 10px;
  padding-bottom: 12px;
  border-top: 1px dashed var(--line);
  margin-top: 4px;
}

/* ================= 详情 ================= */
.detail-hd {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.detail-hd .dh-t {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.3px;
}
.detail-hd .dh-s {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}
.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.kv:last-child {
  border-bottom: 0;
}
.kv .k {
  color: var(--muted);
  flex: 0 0 auto;
}
.kv .v {
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 12px;
}
.action-grid .btn {
  height: 42px;
  font-size: 13.5px;
  padding: 0 8px;
  background: #fff;
}

/* ================= 登录 ================= */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 22px 60px;
  background: linear-gradient(170deg, #eef4ff 0%, #f7fafd 42%, #fff 100%);
}
.login-logo {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  background: linear-gradient(135deg, #1f5fd8, #4f8cf7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin-bottom: 18px;
  box-shadow: 0 10px 24px rgba(31, 95, 216, 0.28);
}
.login-wrap h1 {
  font-size: 23px;
  margin: 0 0 6px;
  letter-spacing: -0.4px;
}
.login-wrap p.sub {
  color: var(--muted);
  margin: 0 0 26px;
  font-size: 14px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.07);
}
.login-hint {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

/* ================= 标签打印 ================= */
.label-sheet {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: #fff;
  padding: 8px;
  border-radius: 10px;
}
.label-item {
  border: 1px dashed #cfd8e6;
  border-radius: 6px;
  padding: 5px 4px 4px;
  text-align: center;
  overflow: hidden;
}
.label-item .ln {
  font-size: 9.5px;
  line-height: 1.25;
  height: 24px;
  overflow: hidden;
  color: #111;
}
.label-item svg {
  width: 100%;
  height: 34px;
  display: block;
}
.label-item .lc {
  font-size: 10px;
  letter-spacing: 0.5px;
  margin-top: 1px;
  font-weight: 600;
}

/* ================= 打印 / PDF ================= */
#print-root {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 400;
  background: #eef1f6;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#print-root.on {
  display: block;
}
.print-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.print-toolbar .btn {
  flex: 1;
}
.paper {
  background: #fff;
  max-width: 720px;
  margin: 14px auto;
  padding: 26px 24px 34px;
  box-shadow: 0 2px 14px rgba(16, 24, 40, 0.1);
  color: #111;
  font-size: 13px;
  line-height: 1.6;
}
.paper h1 {
  font-size: 21px;
  text-align: center;
  margin: 0 0 2px;
  letter-spacing: 3px;
}
.paper .p-shop {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
}
.paper .p-sub {
  text-align: center;
  color: #666;
  font-size: 11.5px;
  margin-bottom: 12px;
}
.paper .p-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 18px;
  border-top: 1.5px solid #333;
  border-bottom: 1.5px solid #333;
  padding: 8px 0;
  margin-bottom: 10px;
  font-size: 12.5px;
}
.paper .p-meta div {
  display: flex;
  gap: 6px;
  overflow: hidden;
}
.paper .p-meta .mk {
  color: #555;
  flex: 0 0 auto;
}
.paper table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.paper th,
.paper td {
  border: 1px solid #999;
  padding: 6px 7px;
  text-align: left;
}
.paper th {
  background: #f2f5fa;
  font-weight: 600;
  text-align: center;
}
.paper td.r,
.paper th.r {
  text-align: right;
}
.paper td.c,
.paper th.c {
  text-align: center;
}
.paper tfoot td {
  font-weight: 600;
}
.paper .p-note {
  margin-top: 10px;
  font-size: 11.5px;
  color: #444;
  line-height: 1.75;
  white-space: pre-wrap;
}
.paper .p-sign {
  display: flex;
  justify-content: space-between;
  margin-top: 34px;
  font-size: 12.5px;
  color: #333;
}
.paper .p-foot {
  margin-top: 18px;
  padding-top: 8px;
  border-top: 1px solid #ddd;
  font-size: 11px;
  color: #777;
  text-align: center;
}

@media print {
  body {
    background: #fff;
  }
  #app,
  #tabbar,
  #toast,
  #modal-root,
  #scan-root,
  .print-toolbar {
    display: none !important;
  }
  #print-root {
    display: block !important;
    position: static;
    background: #fff;
    overflow: visible;
  }
  .paper {
    box-shadow: none;
    margin: 0;
    max-width: none;
    padding: 0;
    font-size: 12px;
  }
  .paper table {
    page-break-inside: auto;
  }
  .paper tr {
    page-break-inside: avoid;
  }
  /* 标签打印机：一张标签一页，去掉预览用的虚线与间距 */
  .lbl-stage {
    padding: 0;
    gap: 0;
    display: block;
  }
  .lbl-page {
    border: 0;
    border-radius: 0;
    margin: 0;
    box-shadow: none;
  }
  @page {
    size: A4;
    margin: 14mm 12mm;
  }
}

.fab {
  position: fixed;
  right: max(16px, calc(50% - 360px + 16px));
  bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: var(--blue);
  color: #fff;
  font-size: 25px;
  box-shadow: 0 8px 20px rgba(31, 95, 216, 0.4);
  z-index: 44;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fab:active {
  transform: scale(0.94);
}

/* ================= 利润 / 收款 ================= */
.pf-mini {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.pf-mini-l {
  font-size: 12.5px;
  color: var(--muted);
}
.pf-mini-n {
  font-size: 24px;
  font-weight: 700;
  color: var(--green);
  margin: 2px 0 3px;
  letter-spacing: -0.4px;
}
.pf-mini-n.neg {
  color: var(--red);
}
.pf-mini-s {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pf-mini-r {
  flex: 0 0 auto;
  text-align: center;
  background: var(--green-l);
  color: var(--green);
  border-radius: 12px;
  padding: 8px 12px;
}
.pf-mini-r b {
  display: block;
  font-size: 16px;
}
.pf-mini-r span {
  font-size: 11px;
  opacity: 0.85;
}

.pf-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.pf-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--muted);
}
.pf-badge {
  background: var(--green-l);
  color: var(--green);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}
.pf-num {
  font-size: 32px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: -0.8px;
  margin: 6px 0 14px;
}
.pf-num.neg {
  color: var(--red);
}
.pf-sub {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #f7f9fc;
  border-radius: 12px;
  padding: 10px 4px;
}
.pf-sub > div {
  text-align: center;
  position: relative;
}
.pf-sub > div + div::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10%;
  height: 80%;
  width: 1px;
  background: var(--line);
}
.pf-sub span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
}
.pf-sub b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
}
.pf-foot {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.bars .b i.neg {
  background: linear-gradient(180deg, #f08b84, #dd3f36);
}
.li-amount.neg {
  color: var(--red);
}

.profit-box {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.profit-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 6px;
}
.profit-line > span:first-child {
  font-size: 13.5px;
  color: var(--text2);
}
.profit-line .num {
  font-size: 21px;
  font-weight: 700;
  color: var(--green);
}
.profit-line .num.neg {
  color: var(--red);
}
.profit-line small {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 5px;
}
.exp-line {
  padding: 5px 0;
  border-bottom: 0;
}
.exp-line .k,
.exp-line .v {
  font-size: 13px;
  color: var(--text2);
}

.ro-line {
  height: 44px;
  line-height: 44px;
  padding: 0 13px;
  background: #f5f7fb;
  border-radius: 11px;
  font-size: 16px;
  font-weight: 600;
}
.exp-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.exp-row .input {
  height: 40px;
  font-size: 14px;
  padding: 0 10px;
}
.exp-row .exp-name {
  flex: 1;
  min-width: 0;
}
.exp-row .exp-amt {
  width: 92px;
  text-align: right;
}
.exp-del {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 0;
  background: var(--red-l);
  color: var(--red);
  border-radius: 9px;
  font-size: 14px;
}
.pay-preview {
  background: #f7f9fc;
  border-radius: 11px;
  padding: 8px 12px;
  margin: 2px 0 14px;
  font-size: 13px;
}
.pay-preview .kv {
  border-bottom: 0;
  padding: 3px 0;
}
.hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.date-range {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.date-range .input {
  height: 40px;
  font-size: 13.5px;
}
.date-range span {
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--muted);
}
.mini-stat {
  flex: 1;
  background: #f7f9fc;
  border-radius: 10px;
  padding: 8px 2px;
}
.mini-stat b {
  display: block;
  font-size: 15px;
}
.mini-stat span {
  font-size: 11px;
  color: var(--muted);
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  word-break: break-all;
}
.tip-card {
  background: var(--amber-l);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 12px;
}
.tip-card b {
  color: #8a5a00;
  font-size: 13.5px;
}
.tip-card p {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: #7a5a12;
  line-height: 1.65;
}
.kv .v.mono {
  white-space: normal;
  word-break: break-all;
  line-height: 1.5;
  max-width: 72%;
}

/* ================= 商品批量导入 ================= */
.imp-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}
.imp-or {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 14px 0 10px;
}
.imp-file {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
}
.imp-map {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
.imp-row label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.imp-row label i {
  color: var(--red);
  font-style: normal;
  margin-left: 2px;
}
.imp-row .input {
  height: 38px;
  font-size: 13px;
  padding: 0 8px;
}
.imp-preview-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.imp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  white-space: nowrap;
}
.imp-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 11.5px;
  padding: 6px 8px;
  background: #f7f9fc;
}
.imp-table td {
  padding: 7px 8px;
  border-top: 1px solid var(--line);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.imp-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.imp-stats {
  display: flex;
  gap: 6px;
  margin-top: 16px;
}
.imp-stats > div {
  flex: 1;
  background: #f7f9fc;
  border-radius: 10px;
  padding: 10px 2px;
}
.imp-stats b {
  display: block;
  font-size: 19px;
  font-weight: 700;
}
.imp-stats span {
  font-size: 11px;
  color: var(--muted);
}

/* ================= 标签（标签打印机） ================= */
.lb-sec {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
}
.lbl-stage {
  padding: 14px 10px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.lbl-page {
  background: #fff;
  box-sizing: border-box;
  padding: 1.1mm 1.4mm;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  border: 1px dashed #c9d3e3;
  border-radius: 2px;
  page-break-after: always;
  break-after: page;
}
.lbl-page:last-child {
  page-break-after: auto;
  break-after: auto;
}
.lbl-nm {
  font-size: 2.6mm;
  line-height: 1.15;
  font-weight: 600;
  text-align: center;
  color: #000;
  width: 100%;
  max-height: 6mm;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}
.lbl-sp {
  font-size: 2.1mm;
  line-height: 1.1;
  color: #333;
  width: 100%;
  text-align: center;
  max-height: 2.6mm;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.lbl-bc {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.3mm 0;
}
.lbl-bc svg {
  height: 100%;
  width: auto;
  max-width: 100%;
  display: block;
}
.lbl-ft {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1.5mm;
}
.lbl-cd {
  font-size: 2.7mm;
  font-weight: 700;
  letter-spacing: 0.15mm;
  color: #000;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.lbl-pr {
  font-size: 2.2mm;
  color: #333;
}
.lb-err {
  font-size: 8px;
  color: var(--red);
}
.pr-info {
  flex: 1;
  min-width: 0;
}
.pr-t {
  font-size: 13.5px;
  font-weight: 600;
}
.pr-tip {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}
.print-toolbar .btn {
  flex: 0 0 auto;
  min-width: 68px;
}

/* ================= 开关（库存预警等） ================= */
.switch {
  display: flex !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch i {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: #d3d9e4;
  transition: background 0.18s;
  flex: 0 0 auto;
}
.switch i::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.22);
  transition: transform 0.18s;
}
.switch input:checked + i {
  background: var(--green);
}
.switch input:checked + i::after {
  transform: translateX(18px);
}
.switch span {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.35;
}
