/* ===== 进销存原型 · 共用样式 ===== */
:root {
  --navy: #1F3864;
  --navy2: #2E4E7E;
  --bg: #F4F6FA;
  --card: #FFFFFF;
  --text: #1B2333;
  --muted: #6B7686;
  --line: #E4E8F0;
  --green: #0E9F6E;
  --amber: #D97706;
  --red: #DC2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 12px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 8px; background: #fff;
  border: 1px solid var(--line); font-weight: 500; transition: .15s;
}
.btn:hover { background: #F7F9FC; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy2); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* pills */
.pill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill.gray  { background: #EEF1F6; color: #5B6577; }
.pill.blue  { background: #E8F0FF; color: #1D5BD6; }
.pill.amber { background: #FEF3E2; color: #B45309; }
.pill.green { background: #E6F6EF; color: #077F58; }
.pill.red   { background: #FDECEC; color: #B91C1C; }
.pill.cyan  { background: #E6F6FA; color: #0E7490; }
.pill.teal  { background: #E8F7F4; color: #0F766E; }
.pill.line  { background: #fff; border: 1px solid var(--line); color: var(--muted); }

/* card */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }

/* tables */
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: #FAFBFD;
}
.table td { padding: 12px; border-bottom: 1px solid #F0F3F8; vertical-align: middle; }
.table tbody tr:hover { background: #FBFCFE; }
.table .r { text-align: right; }
.table .c { text-align: center; }

/* form */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; outline: none; transition: .15s;
}
.textarea { height: 76px; padding: 9px 11px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  border-color: #9DB4E0; box-shadow: 0 0 0 3px rgba(47, 107, 255, .1);
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; color: var(--muted); transition: .15s;
}
.chip.on { border-color: var(--navy); color: var(--navy); background: #EEF3FB; font-weight: 600; }
.chip.sm { height: 28px; padding: 0 11px; font-size: 12.5px; border-radius: 14px; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 20px);
  background: #161D2B; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 999;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===================== PC ===================== */
.pc .shell { display: flex; height: 100vh; overflow: hidden; }
.pc .side {
  width: 212px; flex: 0 0 212px; background: var(--navy); color: #C9D4E8;
  display: flex; flex-direction: column; padding: 18px 12px;
}
.pc .brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 18px; color: #fff; }
.pc .brand .logo {
  width: 30px; height: 30px; border-radius: 8px; background: #3C63A8;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.pc .brand b { font-size: 15px; letter-spacing: .5px; }
.pc .nav { display: flex; flex-direction: column; gap: 2px; }
.pc .nav a {
  display: flex; align-items: center; gap: 9px; height: 38px; padding: 0 11px;
  border-radius: 8px; color: #C9D4E8; font-size: 13.5px;
}
.pc .nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.pc .nav a.on { background: #fff; color: var(--navy); font-weight: 600; }
.pc .side .me {
  margin-top: auto; display: flex; align-items: center; gap: 9px;
  padding: 10px; border-radius: 8px; background: rgba(255, 255, 255, .07);
}
.pc .side .me .av {
  width: 28px; height: 28px; border-radius: 50%; background: #3C63A8;
  display: grid; place-items: center; color: #fff; font-size: 12px;
}
.pc .main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pc .topbar {
  height: 58px; flex: 0 0 58px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
}
.pc .topbar h1 { font-size: 16px; font-weight: 600; }
.pc .topbar .spacer { flex: 1; }
.pc .search {
  display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 8px; background: #FAFBFD; width: 260px;
}
.pc .search input { border: 0; background: none; outline: none; width: 100%; font-size: 13px; }
.pc .view { flex: 1; overflow: auto; padding: 20px 22px 40px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { padding: 16px 18px; }
.kpi .t { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.kpi .v { font-size: 25px; font-weight: 700; letter-spacing: -.4px; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 5px; }
.kpi .s b { color: var(--green); }
.kpi .s b.bad { color: var(--red); }

.grid2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; }
.panel { padding: 0; overflow: hidden; }
.panel .hd {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.panel .hd h3 { font-size: 14px; font-weight: 600; }
.panel .hd .spacer { flex: 1; }
.panel .bd { padding: 8px 0; }

.todo { display: flex; flex-direction: column; }
.todo a { display: flex; align-items: flex-start; gap: 10px; padding: 11px 16px; border-bottom: 1px solid #F2F5FA; }
.todo a:last-child { border-bottom: 0; }
.todo a:hover { background: #FAFBFE; }
.todo .dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 7px; flex: 0 0 7px; }
.todo .dot.amber { background: var(--amber); }
.todo .dot.red { background: var(--red); }
.todo .dot.blue { background: #2F6BFF; }
.todo .tt { font-size: 13px; }
.todo .st { font-size: 12px; color: var(--muted); }

/* filter bar */
.filters { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters .spacer { flex: 1; }

/* order detail */
.od-head { padding: 18px 20px; display: flex; gap: 24px; align-items: flex-start; }
.od-head .t { font-size: 19px; font-weight: 650; letter-spacing: -.2px; }
.od-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 5px; display: flex; gap: 14px; flex-wrap: wrap; }
.od-head .amt { margin-left: auto; text-align: right; }
.od-head .amt .v { font-size: 24px; font-weight: 700; }
.od-head .amt .l { font-size: 12px; color: var(--muted); }

.money3 { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.money3 .m { padding: 15px 20px; border-right: 1px solid var(--line); }
.money3 .m:last-child { border-right: 0; }
.money3 .l { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.money3 .v { font-size: 19px; font-weight: 650; }
.money3 .bar { height: 5px; border-radius: 3px; background: #EDF0F6; margin-top: 8px; overflow: hidden; }
.money3 .bar i { display: block; height: 100%; border-radius: 3px; background: var(--navy2); }
.money3 .bar i.green { background: var(--green); }
.money3 .bar i.amber { background: var(--amber); }

.tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); background: #fff; }
.tabs button {
  padding: 12px 12px; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent;
}
.tabs button.on { color: var(--navy); font-weight: 600; border-bottom-color: var(--navy); }

.timeline { padding: 6px 4px; }
.tl { display: flex; gap: 12px; padding: 9px 12px; }
.tl .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #C6D0E0; margin-top: 7px; flex: 0 0 8px;
  position: relative;
}
.tl .dot::after {
  content: ''; position: absolute; left: 3px; top: 12px; width: 2px; height: calc(100% + 10px); background: #EDF0F6;
}
.tl:last-child .dot::after { display: none; }
.tl .txt { font-size: 13px; }
.tl .time { font-size: 12px; color: var(--muted); }

/* drawer */
.mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .38); z-index: 100;
  opacity: 0; pointer-events: none; transition: .2s;
}
.mask.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 460px; background: #fff; z-index: 101;
  transform: translateX(100%); transition: .26s cubic-bezier(.4, 0, .2, 1);
  display: flex; flex-direction: column; box-shadow: -8px 0 32px rgba(16, 24, 40, .12);
}
.drawer.show { transform: none; }
.drawer .dh, .modal .mh {
  display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.drawer .dh h3, .modal .mh h3 { font-size: 15px; font-weight: 600; }
.drawer .dh .x, .modal .mh .x { margin-left: auto; color: var(--muted); font-size: 18px; line-height: 1; }
.drawer .db { flex: 1; overflow: auto; padding: 18px 20px; }
.drawer .df { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.drawer .df .btn-primary { flex: 1; }

.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -46%) scale(.98);
  width: 520px; background: #fff; border-radius: 12px; z-index: 101; opacity: 0; pointer-events: none;
  transition: .2s; box-shadow: 0 24px 64px rgba(16, 24, 40, .2);
  max-height: 92vh; display: flex; flex-direction: column;
}
.modal.wide { width: 860px; }
.modal .mb { overflow-y: auto; }
.modal.wide .field { margin-bottom: 10px; }
.modal.wide .field > label { margin-bottom: 4px; }
.modal.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal .mb { padding: 18px 20px; }
.modal .mf { padding: 0 20px 18px; display: flex; gap: 10px; justify-content: flex-end; }

/* ===================== 手机 ===================== */
.m-page {
  max-width: 430px; margin: 0 auto; min-height: 100vh; background: #F4F6FA;
  position: relative; display: flex; flex-direction: column;
  box-shadow: 0 0 60px rgba(16, 24, 40, .08);
}
.m-head {
  position: sticky; top: 0; z-index: 10; background: #fff; padding: 12px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.m-head .row { display: flex; align-items: center; gap: 10px; }
.m-head .back { font-size: 20px; line-height: 1; color: var(--muted); width: 22px; }
.m-head h2 { font-size: 16px; font-weight: 600; }
.m-body { flex: 1; padding: 12px 12px 84px; }
.m-search {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  background: #F1F4F9; border-radius: 9px; color: var(--muted);
}
.m-search input { border: 0; background: none; outline: none; width: 100%; font-size: 13.5px; }

.m-card { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.m-order .top { display: flex; align-items: baseline; gap: 8px; }
.m-order .cust { font-size: 15px; font-weight: 600; }
.m-order .no { font-size: 11.5px; color: var(--muted); margin-left: auto; }
.m-order .title { font-size: 12.5px; color: var(--muted); margin: 3px 0 10px; }
.m-order .bot { display: flex; align-items: center; gap: 8px; }
.m-order .amt { margin-left: auto; font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.m-order .prog { font-size: 11.5px; color: var(--muted); }

.m-bignum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-bignum .b { background: #fff; border-radius: 12px; padding: 13px 14px; }
.m-bignum .l { font-size: 11.5px; color: var(--muted); }
.m-bignum .v { font-size: 20px; font-weight: 700; margin-top: 3px; letter-spacing: -.4px; }
.m-bignum .s { font-size: 11px; color: var(--muted); margin-top: 2px; }

.m-tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px; height: 62px; background: #fff;
  border-top: 1px solid var(--line); display: flex; z-index: 20;
}
.m-tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 11px; color: var(--muted);
}
.m-tabbar a.on { color: var(--navy); font-weight: 600; }
.m-tabbar .ic { font-size: 19px; line-height: 1; }
.m-tabbar .fab {
  flex: 0 0 74px; display: flex; align-items: center; justify-content: center;
}
.m-tabbar .fab .b {
  width: 52px; height: 52px; border-radius: 50%; background: var(--navy); color: #fff;
  display: grid; place-items: center; font-size: 24px; margin-top: -18px;
  box-shadow: 0 6px 18px rgba(31, 56, 100, .35);
}

.m-bottom-actions {
  position: fixed; bottom: 62px; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px; padding: 10px 12px; background: #fff;
  border-top: 1px solid var(--line); display: flex; gap: 10px; z-index: 19;
}

/* login */
.login {
  flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 32px;
}
.login .logo {
  width: 62px; height: 62px; border-radius: 17px; background: var(--navy); color: #fff;
  display: grid; place-items: center; font-size: 24px; font-weight: 700; margin-bottom: 22px;
}
.login h1 { font-size: 23px; letter-spacing: -.4px; margin-bottom: 6px; }
.login p { color: var(--muted); font-size: 13px; margin-bottom: 32px; }

/* capture */
.shot-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.shot {
  width: 74px; height: 74px; border-radius: 10px; background: #EEF1F6;
  display: grid; place-items: center; color: var(--muted); font-size: 22px; position: relative;
  overflow: hidden;
}
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot.add { border: 1.5px dashed #C7D0E0; background: #fff; }

/* steps */
.steps { display: flex; align-items: center; gap: 6px; padding: 4px 0 14px; }
.steps .s { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.steps .n {
  width: 20px; height: 20px; border-radius: 50%; background: #E6EAF2; color: #7A8697;
  display: grid; place-items: center; font-size: 11px; font-weight: 600;
}
.steps .s.on { color: var(--navy); font-weight: 600; }
.steps .s.on .n { background: var(--navy); color: #fff; }
.steps .s.done .n { background: var(--green); color: #fff; }
.steps .arr { width: 14px; height: 1px; background: #DCE2EC; }

/* scanner */
.scan {
  position: relative; flex: 1; background: #10151F; display: grid; place-items: center;
  border-radius: 0; overflow: hidden;
}
.scan .frame {
  width: 236px; height: 236px; border-radius: 18px; position: relative;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, .35);
}
.scan .frame i {
  position: absolute; width: 26px; height: 26px; border: 3px solid #5FA8FF; border-radius: 4px;
}
.scan .frame i:nth-child(1) { top: -3px; left: -3px; border-right: 0; border-bottom: 0; }
.scan .frame i:nth-child(2) { top: -3px; right: -3px; border-left: 0; border-bottom: 0; }
.scan .frame i:nth-child(3) { bottom: -3px; left: -3px; border-right: 0; border-top: 0; }
.scan .frame i:nth-child(4) { bottom: -3px; right: -3px; border-left: 0; border-top: 0; }
.scan .line {
  position: absolute; left: 8px; right: 8px; height: 2px; background: #5FA8FF;
  box-shadow: 0 0 12px #5FA8FF; animation: scan 2.2s ease-in-out infinite;
}
@keyframes scan { 0%, 100% { top: 10px; } 50% { top: 222px; } }
.scan .hint {
  position: absolute; bottom: 40px; left: 0; right: 0; text-align: center; color: #9FB0C9; font-size: 12.5px;
}

/* 手机底部导航（桌面端隐藏） */
.mnav { display: none; }

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .pc .shell { display: block; height: auto; overflow: visible; }
  .pc .side { display: none; }
  .pc .main { min-height: auto; }
  .pc .topbar { position: sticky; top: 0; z-index: 20; padding: 0 12px; gap: 8px; }
  .pc .topbar h1 { font-size: 15px; white-space: nowrap; }
  .pc .search { width: 130px; }
  .pc .view { padding: 12px 12px 84px; }
  .card { overflow-x: auto; }
  .table { min-width: 680px; }
  .od-head { flex-direction: column; gap: 10px; }
  .od-head .amt { margin-left: 0; text-align: left; }
  .money3 { grid-template-columns: 1fr; }
  .money3 .m { border-right: 0; border-bottom: 1px solid var(--line); }
  .modal { width: 92vw; }
  .drawer { width: 100vw; }

  .mnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; background: #fff; border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mnav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 0 10px; font-size: 11px; color: var(--muted);
  }
  .mnav a.on { color: var(--navy); font-weight: 600; }
  .mnav a i { font-size: 18px; font-style: normal; line-height: 1; }
}

/* ===== 手机端：底部抽屉式弹窗 + 悬浮按钮 + 扫码取景 ===== */
.fab { display: none; }

@media (max-width: 900px) {
  .modal {
    top: auto; bottom: 0; left: 0; right: 0; width: 100vw;
    max-height: 90vh; border-radius: 18px 18px 0 0;
    transform: translateY(100%);
  }
  .modal.show { transform: none; }
  .modal .mb { max-height: calc(90vh - 128px); overflow-y: auto; }
  .modal .mf { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }

  .fab {
    display: flex; position: fixed; right: 16px; bottom: 84px; z-index: 25;
    width: 56px; height: 56px; border-radius: 50%; background: var(--navy); color: #fff;
    font-size: 26px; align-items: center; justify-content: center;
    box-shadow: 0 8px 24px rgba(31, 56, 100, .35);
  }
}

.scanbox { position: fixed; inset: 0; background: #000; z-index: 200; }
.scanbox video { width: 100%; height: 100%; object-fit: cover; }
.scanbox .frame {
  position: absolute; left: 50%; top: 42%; width: 68vw; max-width: 320px; aspect-ratio: 1;
  transform: translate(-50%, -50%); border: 2px solid #5FA8FF; border-radius: 18px;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, .45);
}
.scanbox .tip {
  position: absolute; left: 0; right: 0; bottom: 120px; text-align: center;
  color: #CFE0FF; font-size: 13px;
}
.scanbox .close {
  position: absolute; top: 18px; right: 18px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255, 255, 255, .16); color: #fff; font-size: 20px; line-height: 1;
}
/* ===== 手机端：列表改卡片，不用横向滚表格 ===== */
.m-cards { display: none; }

@media (max-width: 900px) {
  .only-desktop { display: none !important; }
  .m-cards { display: block; }
  .m-row { display: block; background: #fff; border-radius: 12px; padding: 13px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
  .m-row .l1 { display: flex; align-items: baseline; gap: 8px; }
  .m-row .l1 b { font-size: 15px; font-weight: 650; }
  .m-row .no { margin-left: auto; font-size: 11.5px; color: var(--muted); }
  .m-row .l2 { font-size: 12.5px; color: var(--muted); margin: 3px 0 8px; }
  .m-row .l3 { display: flex; gap: 6px; flex-wrap: wrap; }
  .m-row .l4 { display: flex; align-items: baseline; margin-top: 9px; }
  .m-row .l4 .amt { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
  .m-row .l4 .meta { margin-left: auto; font-size: 11.5px; color: var(--muted); }
  .od-head .t { font-size: 17px; }
  .tabs { overflow-x: auto; }
  .tabs button { white-space: nowrap; }
}
/* 备案号 */
.beian {
  display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap;
  padding: 18px 16px 26px; font-size: 12px; color: var(--muted);
}
.beian a { color: var(--muted); text-decoration: none; }
.beian a:hover { color: var(--navy); text-decoration: underline; }
@media (max-width: 900px) { .beian { padding-bottom: 90px; } }
