/* 仓库管理系统（独立版）界面样式
   设计语言与 Muse 内版保持一致：浅色底、白色圆角卡片、柔和阴影、
   蓝色主色、分段式页签、卡片列表代替密集表格。深色模式自动跟随系统。 */
* { box-sizing: border-box; }
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --card-soft: #f8fafc;
  --text: #16233c;
  --muted: #68738c;
  --line: #e4e8f1;
  --accent: #2563eb;
  --accent-dark: #1e40af;
  --accent-soft: #e8effe;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --warn: #d97706;
  --warn-soft: #fdf3e3;
  --ok: #16a34a;
  --ok-soft: #e7f7ee;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 30px rgba(16, 24, 40, .06);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141b;
    --card: #1a212e;
    --card-soft: #212a3a;
    --text: #e9eef6;
    --muted: #98a4ba;
    --line: #2c3648;
    --accent: #5b8cff;
    --accent-dark: #3b6fe0;
    --accent-soft: #22335c;
    --danger-soft: #452224;
    --warn-soft: #453512;
    --ok-soft: #173d27;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
  }
}
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; }
h2 { font-size: 20px; margin: 18px 0 4px; letter-spacing: .2px; }
h3 { font-size: 15px; margin: 0 0 10px; }

/* ---------- 卡片与容器 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
main { padding: 4px 16px 48px; max-width: 1080px; margin: 0 auto; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(160deg, var(--accent-dark), var(--accent) 55%, #38bdf8 130%); }
.login-card { width: 100%; max-width: 400px; border: none; padding: 26px 24px; border-radius: 20px; }
.login-card h1 { font-size: 21px; margin: 0 0 6px; text-align: center; }
.login-logo { width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 16px; background: linear-gradient(145deg, var(--accent), #38bdf8); display: flex; align-items: center; justify-content: center; font-size: 29px; box-shadow: var(--shadow); }
.login-card .muted { text-align: center; margin: 0 0 8px; }

/* ---------- 表单与按钮 ---------- */
label { display: block; margin: 10px 0; font-size: 13.5px; color: var(--muted); }
input, select, textarea { width: 100%; padding: 10px 12px; margin-top: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 8px 14px; cursor: pointer; font-size: 14px; transition: filter .15s, background .15s; }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: var(--line); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; padding: 11px; font-size: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 0 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }

/* ---------- 顶栏与页签 ---------- */
.topbar { position: sticky; top: 0; z-index: 6; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 9px; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(145deg, var(--accent), #38bdf8); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.userbox { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.userchip { background: var(--accent-soft); color: var(--accent-dark); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; }
@media (prefers-color-scheme: dark) { .userchip { color: var(--text); } }
.tabs { position: sticky; top: 59px; z-index: 5; display: flex; gap: 0; padding: 0 6px; margin: 0 auto; max-width: 1080px; background: var(--card); border-bottom: 2px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; border: none; background: transparent; color: var(--muted); padding: 13px 14px; cursor: pointer; font-size: 17px; font-weight: 600; white-space: nowrap; }
.tabs button.active { color: var(--accent); font-weight: 800; box-shadow: inset 0 -3px 0 var(--accent); }

/* ---------- 总览统计 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.stat { text-align: left; margin: 0; padding: 16px; }
.stat .num { font-size: 27px; font-weight: 800; line-height: 1.15; }
.stat .num.error { color: var(--danger); }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 3px; }
.alert { border-radius: var(--radius); padding: 13px 16px; margin: 12px 0 0; font-size: 14.5px; border: 1px solid; }
.alert.red { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.note { margin-top: 14px; font-size: 13.5px; }
/* 结款明细行 */
.lines { margin-top: 8px; border-top: 1px dashed var(--line); }
/* 库存/提货表格化展示 */
.mini-table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: 14px; }
.mini-table th, .mini-table td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: middle; }
.mini-table thead th { color: var(--muted); font-weight: 600; font-size: 13px; }
.mini-table .total-row td { font-weight: 700; border-bottom: none; }
h4.sec { margin: 16px 0 4px; font-size: 15px; }
.mini-table td.k { color: var(--muted); width: 15%; white-space: nowrap; background: var(--card-soft); font-size: 13px; }
.inv-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.tscroll { overflow-x: auto; }
.mini-table tr.subrow td { border-bottom: 1px solid var(--line); background: var(--card-soft); padding: 6px 8px; }
.card.inv { padding-top: 12px; }
.danger-zone { margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--danger); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.point-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.point-row label { margin: 4px 0; }
@media (max-width: 640px) { .point-row { grid-template-columns: 1fr; } .mini-table { font-size: 13px; } }
.line { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.line .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); color: var(--muted); background: var(--card-soft); vertical-align: middle; }
.badge.red { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.badge.orange { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge.green { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge.blue { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

/* ---------- 列表卡片（预约/用户/客户/结款通用） ---------- */
.item { display: flex; justify-content: space-between; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.item:last-child { border-bottom: none; }
.item .title { font-weight: 700; font-size: 15.5px; }
.item .sub { color: var(--muted); font-size: 13px; margin-top: 2px; line-height: 1.5; }
.item .side { text-align: right; flex-shrink: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; flex-shrink: 0; }
.item .lead { display: flex; gap: 11px; align-items: flex-start; min-width: 0; }

/* ---------- 货柜卡片 ---------- */
details.card { padding: 0; overflow: hidden; }
details.card summary { cursor: pointer; list-style: none; padding: 15px 16px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary .cno { font-size: 16.5px; font-weight: 800; }
details.card summary .fee { margin-left: auto; font-weight: 800; color: var(--accent); font-size: 16px; }
details.card .body { padding: 0 16px 15px; border-top: 1px solid var(--line); }
.pickup { background: var(--card-soft); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; margin: 9px 0; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.pickup .p-main { font-size: 14px; line-height: 1.55; }
.pod-thumb { width: 58px; height: 58px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; }
.inline-form { background: var(--card-soft); border: 1px dashed var(--line); border-radius: 12px; padding: 6px 13px 12px; margin: 10px 0; }
.inline-form label { margin: 6px 0; }

/* ---------- 表格（结款明细等仍保留） ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
tr:last-child td { border-bottom: none; }

/* ---------- 弹层 ---------- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: #16233c; color: #fff; padding: 11px 20px; border-radius: 999px; z-index: 50; box-shadow: var(--shadow); font-size: 14.5px; }
.modal { position: fixed; inset: 0; background: rgba(10, 15, 25, .6); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 14px; }
.modal-card { background: var(--card); border-radius: var(--radius); padding: 16px; max-width: 560px; width: 100%; max-height: 88dvh; overflow: auto; }
.modal-card img { max-width: 100%; border-radius: 10px; }

@media (max-width: 640px) {
  .tabs { top: 57px; margin-left: 10px; margin-right: 10px; }
  main { padding: 4px 10px 44px; }
  .item { flex-direction: column; }
  .item .side { text-align: left; }
  details.card summary .fee { margin-left: 0; }
}

/* 入库子模块分段切换 */
.seg { display: flex; gap: 6px; margin: 10px 0 4px; }
.seg button { flex: 1; padding: 10px 0; border: 1px solid var(--line); border-radius: 99px; background: var(--card); color: var(--muted); font-size: 14px; cursor: pointer; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
/* 进度步骤 */
.steps { display: flex; margin: 10px 0 4px; }
.steps .s { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); position: relative; padding-top: 15px; }
.steps .s::before { content: ""; position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 9px; height: 9px; border-radius: 50%; background: var(--line); z-index: 1; }
.steps .s::after { content: ""; position: absolute; top: 8px; left: calc(-50% + 7px); width: calc(100% - 14px); height: 2px; background: var(--line); }
.steps .s:first-child::after { display: none; }
.steps .s.done { color: var(--accent); font-weight: 700; }
.steps .s.done::before { background: var(--accent); }
.steps .s.now { color: #b45309; font-weight: 700; }
.steps .s.now::before { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,.25); }
/* 上架进度条与库位 chips */
.bar { height: 8px; background: var(--card-soft); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.bar i { display: block; height: 100%; background: var(--accent); }
.chip { display: inline-block; font-size: 12px; background: var(--card-soft); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }
.cno { font-size: 16.5px; font-weight: 800; }
h3.sec { margin: 16px 0 8px; font-size: 15px; }

/* 扫码按钮与取景框 */
.scan-btn { margin-top: 6px; }
#scanReader { border-radius: 12px; overflow: hidden; }
#scanReader video { border-radius: 12px; }

/* 总览工作台：可点数字块 + 空段落行 + 定位闪烁 */
.stat-card { text-align: center; margin: 0; padding: 14px 8px 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; width: 100%; }
.stat-card .num { font-size: 26px; font-weight: 800; line-height: 1.15; color: var(--text); }
.stat-card .lbl { color: var(--muted); font-size: 13px; margin-top: 3px; }
.stat-card .go { color: var(--accent); font-size: 11.5px; margin-top: 3px; }
.stat-card.hot { border-color: var(--warn); background: var(--warn-soft); }
.stat-card.hot .num { color: var(--warn); }
.empty-line { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 11px 14px; color: var(--muted); font-size: 13.5px; margin: 8px 0; }
.stock-line { cursor: pointer; }
.flash { outline: 3px solid var(--warn); outline-offset: 2px; transition: outline-color .3s; }

/* 客户管理：账单勾选 + 导出条 + 操作记录时间线 */
.bill-check { display: flex; align-items: flex-start; padding-top: 3px; }
.bill-check input { width: 21px; height: 21px; accent-color: var(--accent); cursor: pointer; }
.exportbar { position: sticky; bottom: 10px; background: #1a2332; color: #fff; border-radius: 14px; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; margin: 12px 0; box-shadow: var(--shadow); z-index: 5; }
.exportbar .btn { background: rgba(255,255,255,.14); color: #fff; border-color: transparent; }
.exportbar .btn.primary { background: var(--accent); }
.exportbar .btn:disabled { opacity: .45; }
.ok { color: var(--ok); font-weight: 700; }
.err { color: var(--danger); font-weight: 700; }
.tl { position: relative; margin-left: 6px; padding-left: 18px; }
.tl::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.tl .ev { position: relative; padding: 6px 0; font-size: 13.5px; line-height: 1.6; }
.tl .ev::before { content: ""; position: absolute; left: -18.5px; top: 13px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.tl .tm { color: var(--muted); font-size: 12.5px; }
.tl .who { color: var(--accent); font-weight: 700; }
.money-line { color: var(--muted); }

/* 测试演示实例横幅（正式实例不显示） */
.instance-banner { background: var(--warn); color: #fff; text-align: center; font-weight: 800; font-size: 14.5px; padding: 9px 12px; letter-spacing: .3px; }

/* 扫码小取景框：小而居中，方便对准 */
.scan-frame { position: relative; width: min(76vw, 300px); height: 215px; margin: 8px auto; border: 2px solid #2f6fed; border-radius: 12px; overflow: hidden; background: #000; }
.scan-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.seg .seg-label { align-self: center; font-size: 13px; color: var(--muted); white-space: nowrap; }
.pod-preview { display: block; max-width: 240px; max-height: 180px; border-radius: 8px; margin-top: 8px; border: 1px solid var(--line); }
