:root {
    --bg: #f4f4f2; --card: #fff; --ink: #1f2328; --muted: #6b7280; --line: #e3e3df;
    --primary: #b4532a; --ok: #1a7f4b; --warn: #b45309; --danger: #b42318;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
a { color: var(--primary); text-decoration: none; }
h2 { font-size: 16px; margin: 0 0 10px; }
small { color: var(--muted); font-size: 12px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 17px; margin: 0; }
.who { color: var(--muted); font-size: 13px; }
main { max-width: 960px; margin: 0 auto; padding: 12px 12px 150px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; background: var(--card);
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; text-align: center; padding: 13px 0; color: var(--muted); font-size: 14px; }
.tabs a.on { color: var(--primary); font-weight: 600; }

.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; color: inherit; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.flash { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
.err { color: var(--danger); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
input:not([type=checkbox]):not([type=file]), select {
    display: block; width: 100%; height: 42px; margin-top: 4px; padding: 0 10px; font-size: 16px; color: var(--ink);
    background: #fff; border: 1px solid var(--line); border-radius: 8px; }
input[type=file] { display: block; margin-top: 6px; max-width: 100%; }
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

.btn { display: inline-flex; align-items: center; justify-content: center; height: 42px; padding: 0 16px; font-size: 15px;
    color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f3c7c2; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.link { background: none; border: 0; color: var(--danger); font-size: 14px; padding: 4px; cursor: pointer; }

.tag { display: inline-block; font-size: 12px; font-weight: 400; padding: 1px 8px; border-radius: 99px; background: #f1f5f1; }
.tag.warn { background: #fff4e5; }
.order > div { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.order-row { display: flex; align-items: center; gap: 12px; }
.order-row .order { flex: 1; min-width: 0; color: inherit; }
.order-row input[type=checkbox], .pickall input { width: 20px; height: 20px; flex: none; accent-color: var(--primary); }
.pickall { display: flex; align-items: center; gap: 8px; margin: 0 0 10px 15px; }
.quick { display: flex; gap: 8px; margin-bottom: 8px; }
.quick a { flex: 1; text-align: center; padding: 7px 0; font-size: 14px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.quick a.on { color: #fff; background: var(--primary); border-color: var(--primary); }
.proof img { display: block; max-width: 220px; max-height: 300px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 12px; }

.filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filter input:not([type=hidden]), .filter select { flex: 1 1 130px; width: auto; margin: 0; }
.stat { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat > div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stat small { display: block; }
.stat b { font-size: 17px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 12px 0; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; white-space: nowrap; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; }
th { color: var(--muted); font-weight: 400; font-size: 13px; }
th.l, td.l { text-align: left; }
tr.total td { font-weight: 600; border-bottom: 0; }

/* 开单 */
.item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.item-body { display: flex; gap: 10px; }
.photo { flex: 0 0 84px; height: 84px; margin: 0; display: flex; align-items: center; justify-content: center; cursor: pointer;
    border: 1px dashed #c9c9c4; border-radius: 8px; background: #fafaf8 center/cover no-repeat; color: var(--muted); }
.photo.has span { display: none; }
.photo.busy { opacity: .5; }
.fields { flex: 1; min-width: 0; }
.fields > input { margin-top: 0 !important; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.row3 label { margin: 0; }
.item-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 10px; }
.item-foot label { flex: 0 0 130px; margin: 0; }
.item-foot .price { color: var(--muted); font-size: 13px; text-align: right; }
.item-foot .price b { display: block; color: var(--primary); font-size: 20px; line-height: 42px; }
.bar { position: fixed; left: 0; right: 0; bottom: calc(47px + env(safe-area-inset-bottom)); z-index: 6; display: flex;
    align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; background: var(--card); border-top: 1px solid var(--line); }
.bar .sum small { display: block; }

/* 销售单图片 */
.sheet-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; min-height: 80px; }
.sheet-wrap img { display: block; width: 100%; min-width: 320px; }
.qr { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.qr img { width: 84px; height: 84px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; }
