/* ============ Buddhiherz · 浅色清爽风（蓝青主色 / 卡片层次 / 大圆角） ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --pri: #0369a1;        /* 主色：深天蓝 */
  --pri2: #0ea5e9;       /* 亮蓝 */
  --cy: #06b6d4;         /* 青 */
  --grad: linear-gradient(135deg, #0ea5e9 0%, #0891b2 55%, #0f766e 100%);
  --accent: #0ea5e9;     /* 统一强调色（模板里 var(--accent) 的唯一取值） */
  --bg: #f4f8fb;
  --card: #ffffff;
  --ok: #16a34a; --warn: #d97706; --err: #dc2626;
  --txt: #0f172a; --mut: #64748b;
  --line: #e6edf4;
  --sh-1: 0 1px 2px rgba(15, 23, 42, .05);
  --sh-2: 0 2px 6px rgba(15, 23, 42, .06), 0 12px 28px -16px rgba(2, 68, 105, .35);
  --r-lg: 18px; --r-md: 13px; --r-sm: 10px;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(1200px 320px at 15% -60px, rgba(14, 165, 233, .10), transparent 60%),
    radial-gradient(900px 260px at 90% 0, rgba(6, 182, 212, .08), transparent 60%),
    var(--bg);
  color: var(--txt);
  padding-bottom: 78px;
  line-height: 1.55;
}
a { color: var(--pri); text-decoration: none; }
a:hover { opacity: .88; }

/* ---------- 顶栏 ---------- */
header {
  background: var(--grad);
  color: #fff;
  padding: 12px 16px;
  box-shadow: 0 6px 20px -10px rgba(3, 105, 161, .7);
  position: sticky; top: 0; z-index: 40;
}
.hd-in { max-width: 940px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.brand { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.brand small { font-weight: 400; opacity: .85; font-size: 12px; }
.who { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.who .mini { color: #fff; opacity: .85; background: rgba(255, 255, 255, .18); padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.who .mini:hover { opacity: 1; background: rgba(255, 255, 255, .3); }

/* ---------- 页签（上导航） ---------- */
.topnav { max-width: 940px; margin: 0 auto; display: flex; gap: 4px; padding: 8px 10px 0; flex-wrap: wrap; }
.topnav a { padding: 8px 14px; border-radius: 10px 10px 0 0; font-size: 14px; color: var(--mut); background: #e8eff6; }
.topnav a.on { background: var(--card); color: var(--pri); font-weight: 600; box-shadow: var(--sh-1); }

main { max-width: 940px; margin: 0 auto; padding: 14px 12px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid rgba(230, 237, 244, .9);
  box-shadow: var(--sh-2);
}
.card h2 {
  font-size: 15px; margin-bottom: 12px; color: #0f172a;
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-bottom: 10px; border-bottom: 1px dashed var(--line);
}
.card h3 { font-size: 14px; color: #334155; margin: 14px 0 8px; }

.flash { padding: 11px 14px; border-radius: var(--r-md); margin-bottom: 12px; font-size: 14px; box-shadow: var(--sh-1); }
.flash.ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---------- 统计块 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat {
  background: var(--card); border-radius: var(--r-md); padding: 15px 12px; text-align: center;
  border: 1px solid rgba(230, 237, 244, .9); box-shadow: var(--sh-1);
  transition: transform .12s ease, box-shadow .12s ease;
}
.stat:active { transform: scale(.98); }
.stat .num { font-size: 27px; font-weight: 700; color: var(--pri); line-height: 1.2; }
.stat .lb { font-size: 12px; color: var(--mut); margin-top: 3px; }
.stat.warn .num { color: var(--warn); }
.stat.err .num { color: var(--err); }
.stat.ok .num { color: var(--ok); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block; padding: 10px 16px; border: none; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; cursor: pointer; background: #e9f1f8; color: #0f172a;
  box-shadow: var(--sh-1); transition: transform .1s ease, filter .1s ease;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: scale(.97); }
.btn-pri { background: linear-gradient(135deg, #0ea5e9, #0284c7); color: #fff; box-shadow: 0 6px 16px -8px rgba(2, 132, 199, .9); }
.btn-ok { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; }
.btn-warn { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.btn-err { background: linear-gradient(135deg, #f87171, #dc2626); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-lg { width: 100%; padding: 14px; font-size: 16px; border-radius: 14px; }
a.btn { text-align: center; }

/* ---------- 表单 ---------- */
label { display: block; font-size: 13px; color: #475569; margin: 9px 0 4px; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--r-sm);
  font-size: 15px; background: #fbfdff; color: var(--txt);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--pri2); background: #fff;
  box-shadow: 0 0 0 4px rgba(14, 165, 233, .14);
}
input::placeholder, textarea::placeholder { color: #94a3b8; }
.frow { display: flex; gap: 8px; align-items: flex-end; }
.frow > div { flex: 1; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 7px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--mut); font-weight: 700; font-size: 12px; white-space: nowrap; letter-spacing: .3px; }
tbody tr:hover, tr:hover { background: #f8fbfe; }
.tblwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* 商品管理：尺寸 / 位置 列可折叠（屏幕不够宽时收起，点表头按钮展开） */
.colx { display: none; }
.tblwrap.colx-on .colx { display: table-cell; }
/* 表单里「尺寸和位置」折叠组（添加商品 / 编辑商品） */
.pm-fold {
  margin-top: 10px; border: 1px dashed #bae0f5; border-radius: var(--r-md);
  padding: 8px 10px; background: #f7fbff;
}
.pm-fold summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--pri); }

/* ---------- 徽章 / 标签 ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.b-pending { background: #fef3c7; color: #92400e; }
.b-picking { background: #dbeafe; color: #1e40af; }
.b-shipped { background: #dcfce7; color: #166534; }
.b-exception { background: #fee2e2; color: #991b1b; }
.b-mut { background: #eef2f6; color: #64748b; }

.loc { color: var(--pri); font-weight: 700; }
.qty { font-weight: 700; }
.low .qty { color: var(--err); }
.lowflag { color: var(--err); font-size: 11px; }

.muted { color: var(--mut); font-size: 12px; }
.big { font-size: 18px; font-weight: 700; }
.tag {
  display: inline-block; background: #ecf6ff; color: var(--pri); border: 1px solid #cfe6fb;
  border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 600; margin: 2px 4px 2px 0;
}
.tag.b-exception { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.tag.b-shipped { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.tag.b-mut { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
.tag.b-pending { background: #fffbeb; color: #b45309; border-color: #fde68a; }

/* ---------- 打卡 ---------- */
.clockbox {
  text-align: center; padding: 20px 16px;
  background: linear-gradient(160deg, #ffffff, #f2faff);
}
.clockbox .t { font-size: 23px; font-weight: 700; margin-bottom: 6px; }
.clockbox .s { color: var(--mut); font-size: 13px; margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.clockbtns { display: flex; gap: 10px; }
.clockbtns .btn { flex: 1; padding: 15px; font-size: 16px; }

/* ---------- 页签 ---------- */
.tabs { display: flex; gap: 5px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 15px; border-radius: 999px; background: #e9f1f8; color: var(--mut); font-size: 13px; font-weight: 600; }
.tabs a.on { background: linear-gradient(135deg, #0ea5e9, #0284c7); color: #fff; box-shadow: 0 6px 14px -8px rgba(2, 132, 199, .9); }

/* ---------- 底部导航 ---------- */
.botnav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
  display: flex; border-top: 1px solid var(--line);
  z-index: 50; padding-bottom: env(safe-area-inset-bottom, 0);
}
.botnav a { flex: 1; text-align: center; padding: 9px 0 8px; font-size: 17px; color: var(--mut); position: relative; }
.botnav a span { display: block; font-size: 11px; margin-top: 1px; font-weight: 600; }
.botnav a.on { color: var(--pri); font-weight: 700; }
.botnav a.on::after {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 34px; height: 3px; border-radius: 0 0 4px 4px; background: linear-gradient(90deg, #0ea5e9, #06b6d4);
}

/* ---------- 拣货行 / 列表行 ---------- */
.pickrow {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border-radius: var(--r-md); padding: 15px; margin-bottom: 10px;
  border: 1px solid rgba(230, 237, 244, .9); box-shadow: var(--sh-1);
}
.pickrow .nm { font-size: 16px; font-weight: 600; }
.pickrow .loc { font-size: 15px; margin-top: 3px; }
.pickrow .qt { font-size: 20px; font-weight: 700; color: var(--err); }

/* ---------- 空状态 ---------- */
.empty { text-align: center; color: var(--mut); padding: 34px 12px; font-size: 14px; line-height: 1.8; }
.empty::before { content: "📭"; display: block; font-size: 34px; margin-bottom: 6px; opacity: .8; }

/* ---------- 菜单 ---------- */
.menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.menu a {
  background: var(--card); border-radius: var(--r-md); padding: 17px 10px; text-align: center;
  border: 1px solid rgba(230, 237, 244, .9); box-shadow: var(--sh-1); color: var(--txt);
}
.menu .ic { font-size: 26px; }
.menu .t { font-size: 14px; font-weight: 600; margin-top: 4px; }
.menu .d { font-size: 11px; color: var(--mut); margin-top: 2px; }

/* ============ 开账单：更多选项（折叠） ============ */
.iv-more {
  margin-top: 14px; border: 1px dashed #bae0f5; border-radius: var(--r-md);
  padding: 10px 12px; background: #f7fbff;
}
.iv-more summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--pri); }
.iv-more[open] summary { margin-bottom: 4px; }
.iv-more-hint { font-weight: 400; font-size: 12px; color: var(--mut); margin-left: 6px; }

/* ============ 确认页（人工确认） ============ */
.cf-hero { padding: 4px 2px 12px; }
.cf-hero h1 { font-size: 21px; margin: 10px 0 4px; }
.cf-step { display: flex; gap: 6px; flex-wrap: wrap; }
.cf-step span {
  font-size: 12px; font-weight: 700; color: var(--mut);
  background: #e9f1f8; border-radius: 999px; padding: 4px 12px;
}
.cf-step span.on { background: linear-gradient(135deg, #0ea5e9, #0891b2); color: #fff; box-shadow: 0 6px 14px -8px rgba(2, 132, 199, .9); }
.cf-step span.done { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
/* 确认页明细表：移动端不横向溢出 */
.cf-card table { font-size: 12.5px; table-layout: fixed; width: 100%; }
.cf-card th, .cf-card td { padding: 7px 4px; overflow-wrap: anywhere; }
.cf-card th:nth-child(2), .cf-card td:nth-child(2) { display: none; }   /* 货号列窄屏隐藏 */
@media (min-width: 560px) {
  .cf-card th:nth-child(2), .cf-card td:nth-child(2) { display: table-cell; }
  .cf-card table { font-size: 13px; }
}
.iv-hint { overflow-wrap: anywhere; }
.cf-card { border-left: 4px solid #7dd3fc; }
.cf-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.cf-kv > div { background: #f8fbfe; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 12px; }
.cf-kv span { display: block; font-size: 11px; color: var(--mut); font-weight: 700; letter-spacing: .4px; }
.cf-kv b { font-size: 15px; }
.cf-addr { font-size: 16px; line-height: 1.7; font-weight: 600; }
.cf-boxes { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.cf-box {
  background: linear-gradient(160deg, #f0f9ff, #e0f2fe);
  border: 1px solid #bae6fd; border-radius: var(--r-sm);
  padding: 8px 14px; font-size: 13px; color: #075985; text-align: center; line-height: 1.5;
}
.cf-box b { display: block; font-size: 17px; }
.cf-money { display: grid; gap: 6px; }
.cf-money > div { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 2px; }
.cf-money span { color: var(--mut); }
.cf-total { border-top: 1.5px dashed var(--line); margin-top: 4px; padding-top: 10px !important; font-size: 16px; }
.cf-total b { font-size: 20px; color: var(--pri); }
.cf-gen { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.cf-actions { display: flex; gap: 10px; margin-top: 4px; }
.cf-back { flex: 1; background: #e9f1f8; }
.cf-ok { flex: 2; }

/* 开账单：主按钮吸底（长表单填完不用滚回去） */
.iv-submit {
  position: sticky; bottom: 74px; z-index: 20; margin-top: 16px; padding: 10px 0 2px;
  background: linear-gradient(to top, var(--bg) 72%, rgba(244, 248, 251, 0));
}

/* ============ 打印 ============ */
@media print {
  header, .topnav, .botnav, .no-print, .flash, .cf-actions { display: none !important; }
  body { background: #fff; padding: 0; }
  main { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

/* ============ 日历 ============ */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.cal-hd { text-align: center; font-size: 12px; color: var(--mut); font-weight: 700; padding: 4px 0; }
.cal-cell {
  position: relative; border: 1px solid var(--line); border-radius: 10px; padding: 4px;
  min-height: 58px; display: flex; flex-direction: column; gap: 2px; background: #fff;
}
.cal-cell.cal-today { outline: 2px solid var(--pri2); outline-offset: -1px; background: #f0faff; }
.cal-cell.cal-me { background: #fef2f2; border-color: #fca5a5; }
.cal-day { font-size: 13px; font-weight: 700; color: var(--txt); }
.cal-mark { font-size: 10px; border-radius: 5px; padding: 1px 3px; text-align: center; }
.cal-mark.me { background: #ef4444; color: #fff; }
.cal-mark.other { background: #e9f1f8; color: #475569; }
.cal-btn {
  margin-top: auto; width: 100%; font-size: 10px; padding: 3px 0;
  border: 1px solid var(--line); border-radius: 6px; background: #f8fbfe;
  color: #475569; cursor: pointer;
}
.cal-btn:hover { background: linear-gradient(135deg, #0ea5e9, #0284c7); color: #fff; border-color: transparent; }
.cal-recv { background: #ffedd5; color: #c2410c; border-radius: 5px; padding: 1px 3px; font-size: 10px; text-align: center; font-weight: 700; }
.cal-btn.recv { margin-top: 2px; background: #fff7ed; color: #c2410c; border-color: #fdba74; }
.cal-btn.recv:hover { background: #f97316; color: #fff; }
.cal-past { background: #f8fafc; opacity: .8; }
.cal-shift { border-radius: 5px; padding: 1px 3px; font-size: 10px; color: #fff; font-weight: 700; text-align: center; margin-top: 1px; }
.cal-btn-hint { position: absolute; top: 2px; right: 4px; font-size: 9px; color: #94a3b8; }
.cal-cell { cursor: pointer; }
