/* ============================================================
   大闸蟹记账助手 · 样式
   主分辨率 iPad Air 4：1180 × 820（横屏）
   ============================================================ */

:root {
  --bg:        #f4f5f7;
  --surface:   #ffffff;
  --surface-2: #fafbfc;
  --border:    #e3e5e9;
  --border-2:  #cdd2d9;

  --text:      #1a1d21;
  --text-2:    #495057;
  --muted:     #868e96;

  --primary:      #d9480f;   /* 蟹壳红 */
  --primary-dark: #b93a08;
  --primary-weak: #fff4ee;

  --male:      #1971c2;      /* 公蟹 */
  --male-weak: #e7f1fb;
  --female:    #c2255c;      /* 母蟹 */
  --female-weak: #fdebf2;

  --money:     #c92a2a;
  --ok:        #2f9e44;
  --danger:    #e03131;

  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .12);

  --nav-h:     64px;
  --tap:       48px;         /* 最小点击高度 */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body { padding-top: var(--nav-h); }

h1, h2, h3, h4 { margin: 0; font-weight: 600; }

a { color: var(--primary); text-decoration: none; }

/* ── 顶部导航 ──────────────────────────────────────────── */
.nav {
  position: fixed; inset: 0 0 auto 0; height: var(--nav-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.nav-brand {
  font-size: 19px; font-weight: 700; letter-spacing: .5px;
  color: var(--primary); margin-right: 12px; white-space: nowrap;
}
.nav-tabs { display: flex; gap: 6px; flex: 1; }
.nav-tab {
  display: flex; align-items: center;
  height: 42px; padding: 0 20px;
  border-radius: 21px;
  font-size: 17px; font-weight: 500; color: var(--text-2);
  white-space: nowrap;
}
.nav-tab:active { background: var(--surface-2); }
.nav-tab.on { background: var(--primary); color: #fff; font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 10px; }

/* ── 容器 ──────────────────────────────────────────────── */
.wrap { max-width: 1140px; margin: 0 auto; padding: 22px 24px 140px; }
.wrap.narrow { max-width: 760px; }

.page-head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.page-head h1 { font-size: 26px; }
.page-head .spacer { flex: 1; }

/* ── 卡片 ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 15px; font-weight: 600; color: var(--muted);
  letter-spacing: .4px; margin-bottom: 14px;
}

/* ── 按钮 ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 22px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 17px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:active { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:active { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-danger { color: var(--danger); border-color: #f2c2c2; }
.btn-danger:active { background: #fff5f5; }

.btn-lg { min-height: 58px; font-size: 20px; padding: 0 34px; border-radius: var(--radius); }
.btn-sm { min-height: 38px; font-size: 15px; padding: 0 14px; }
.btn-block { width: 100%; }

/* ── 表单 ──────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field > label {
  display: block; font-size: 15px; font-weight: 600;
  color: var(--text-2); margin-bottom: 8px;
}

.input, .select, .textarea {
  width: 100%; min-height: var(--tap);
  padding: 10px 14px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 17px;
  -webkit-appearance: none;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-weak);
}
.textarea { min-height: 76px; resize: vertical; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

/* 日期 / 数字输入 */
.input[type="date"] { min-height: var(--tap); }
.input.num { text-align: center; font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── 快捷标签（拿货人 / 制单人 / 备注）──────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--border-2); border-radius: 20px;
  background: var(--surface); color: var(--text-2);
  font-size: 16px; cursor: pointer;
}
.chip:active { background: var(--primary-weak); border-color: var(--primary); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.chip .n { font-size: 13px; color: var(--muted); }
.chip.on .n { color: rgba(255,255,255,.75); }

/* ── 拿货人下拉（查询历史：输入 + 下拉，别用一堆标签堆着）──── */
.suggest-wrap { position: relative; }
.suggest-drop {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
  max-height: 264px; overflow: auto;
  margin-top: 4px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.suggest-item {
  display: flex; align-items: center; min-height: 44px;
  padding: 10px 14px; font-size: 16px; color: var(--text);
  cursor: pointer;
}
.suggest-item + .suggest-item { border-top: 1px solid var(--border); }
.suggest-item:hover, .suggest-item.on { background: var(--primary-weak); color: var(--primary); }

/* ── 规格点选区 ────────────────────────────────────────── */
.spec-group { margin-bottom: 18px; }
.spec-group:last-child { margin-bottom: 0; }
.spec-group-head {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 700; margin-bottom: 12px;
}
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.male { background: var(--male); }
.dot.female { background: var(--female); }
.spec-group-head .hint { font-weight: 400; font-size: 14px; color: var(--muted); }

.spec-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.spec-btn {
  min-width: 88px; min-height: 54px; padding: 0 16px;
  border: 1.5px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: 19px; font-weight: 600; cursor: pointer;
  transition: all .12s;
}
.spec-btn:active { transform: scale(.96); }
.spec-btn.on { color: #fff; border-color: transparent; }
.spec-btn.on.male   { background: var(--male); }
.spec-btn.on.female { background: var(--female); }

/* ── 明细行 ────────────────────────────────────────────── */
.items { display: flex; flex-direction: column; gap: 10px; }

.item-row {
  display: grid;
  grid-template-columns: 120px 1fr 1fr 130px 48px;
  align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.item-row .spec {
  font-size: 19px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.item-row .spec.male   { color: var(--male); }
.item-row .spec.female { color: var(--female); }
.item-row .amount {
  text-align: right; font-size: 21px; font-weight: 700;
  color: var(--money); font-variant-numeric: tabular-nums;
}
.item-row .del {
  width: 44px; height: 44px; border: none; background: none;
  color: var(--muted); font-size: 22px; cursor: pointer; border-radius: var(--radius-sm);
}
.item-row .del:active { background: #fff0f0; color: var(--danger); }

.item-head {
  display: grid;
  grid-template-columns: 120px 1fr 1fr 130px 48px;
  gap: 12px; padding: 0 14px 6px;
  font-size: 14px; font-weight: 600; color: var(--muted);
}
.item-head .r { text-align: right; }
.item-head .u { font-weight: 400; }   /* 单位。窄屏会隐藏，见下面的媒体查询 */

.empty {
  padding: 34px 20px; text-align: center;
  color: var(--muted); font-size: 16px;
}

/* ── 底部合计条 ────────────────────────────────────────── */
.bottombar {
  position: fixed; inset: auto 0 0 0;
  display: flex; align-items: center; gap: 20px;
  padding: 14px 24px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(16,24,40,.06);
  z-index: 90;
}
.bottombar .totals { flex: 1; display: flex; align-items: baseline; gap: 26px; flex-wrap: wrap; }
.bottombar .t-label { font-size: 15px; color: var(--muted); margin-right: 6px; }
.bottombar .t-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bottombar .t-value.money { color: var(--money); }

/* ── 表格（汇总 / 列表）────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 13px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.table th {
  font-size: 14px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); white-space: nowrap;
}
.table th.r, .table td.r { text-align: right; }
.table tbody tr:active { background: var(--surface-2); }
.table td.num { font-size: 18px; font-weight: 600; }
.table td.money { font-size: 19px; font-weight: 700; color: var(--money); }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-bottom: none; }
.table-wrap { overflow-x: auto; }

/* 单据列表卡片 */
.slip-list { display: flex; flex-direction: column; gap: 12px; }
.slip-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
/* 整张卡的可点区域（进详情），右边留出按钮的位置 */
.slip-link {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 16px;
  color: inherit; text-decoration: none;
  border-radius: var(--radius-sm);
}
.slip-link:active { background: var(--surface-2); }

/* 卡片右侧的「预览 / 导出」 */
.slip-actions { display: flex; gap: 8px; flex: none; }
.slip-actions .btn { min-height: 44px; }

/* 勾选框 */
.slip-check { flex: none; display: flex; align-items: center; padding: 0 2px; cursor: pointer; }
.slip-check input { width: 24px; height: 24px; accent-color: var(--primary); cursor: pointer; }

/* 批量操作条 */
.batch-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px; margin-bottom: 12px;
  background: var(--primary-weak);
  border: 1px solid #f5cdb8; border-radius: var(--radius-sm);
}
.batch-all {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.batch-all input { width: 22px; height: 22px; accent-color: var(--primary); cursor: pointer; }
.batch-count { flex: 1; font-size: 15px; color: var(--text-2); }
.slip-thumb {
  width: 68px; height: 68px; flex: none; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  object-fit: cover;
}
.slip-thumb.blank { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 22px; }
.slip-main { flex: 1; min-width: 0; }
.slip-main .top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.slip-main .buyer { font-size: 20px; font-weight: 700; }
.slip-main .date { font-size: 15px; color: var(--muted); }
.slip-main .sub { font-size: 15px; color: var(--muted); margin-top: 3px; }
.slip-amount { font-size: 24px; font-weight: 700; color: var(--money); font-variant-numeric: tabular-nums; }

/* ── 汇总页签 ──────────────────────────────────────────── */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  min-height: 46px; padding: 0 22px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-2);
  font: inherit; font-size: 17px; cursor: pointer;
}
.tab.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* ── 统计块 ────────────────────────────────────────────── */
.stats { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.stat {
  flex: 1; min-width: 150px;
  padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.stat .k { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.stat .v { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .v.money { color: var(--money); }

/* ── 照片 ──────────────────────────────────────────────── */
.photo-strip { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-item { position: relative; }
.photo-item img {
  width: 132px; height: 132px; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  display: block; background: var(--surface-2);
}
.photo-item .x {
  position: absolute; top: -8px; right: -8px;
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid #fff; background: var(--danger); color: #fff;
  font-size: 17px; line-height: 1; cursor: pointer;
}
.photo-add {
  width: 132px; height: 132px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 2px dashed var(--border-2); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--muted);
  font-size: 14px; cursor: pointer;
}
.photo-add .plus { font-size: 30px; line-height: 1; }
.photo-add:active { border-color: var(--primary); color: var(--primary); }

/* ── 提示条 ────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(16px);
  padding: 13px 24px; border-radius: 24px;
  background: rgba(26,29,33,.92); color: #fff; font-size: 16px;
  opacity: 0; pointer-events: none; transition: all .2s; z-index: 200;
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: rgba(200,36,36,.95); }

/* ── 弹层 ──────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 300;
  display: none; align-items: center; justify-content: center;
  background: rgba(16,24,40,.45); padding: 24px;
}
.modal.show { display: flex; }
.modal-box {
  background: var(--surface); border-radius: var(--radius);
  padding: 24px; max-width: 520px; width: 100%;
  max-height: 86vh; overflow: auto; box-shadow: var(--shadow-lg);
}
.modal-box h3 { font-size: 20px; margin-bottom: 14px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }

/* 导出预览 */
.export-preview { text-align: center; }
.export-preview img {
  max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

/* ── 登录页 ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--bg);
}
.login-box {
  width: 100%; max-width: 400px; padding: 34px 30px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); text-align: center;
}
.login-box h1 { font-size: 24px; color: var(--primary); margin-bottom: 6px; }
.login-box p { color: var(--muted); font-size: 15px; margin: 0 0 24px; }

/* ── 杂项 ──────────────────────────────────────────────── */
.muted { color: var(--muted); }
.small { font-size: 14px; }
.right { text-align: right; }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }
.hidden { display: none !important; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* 走势图 */
.trend { width: 100%; height: 260px; display: block; }

/* ── 修改日志 ──────────────────────────────────────────── */
.log-list { display: flex; flex-direction: column; gap: 10px; }

.log-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}
.log-item:active { background: var(--surface-2); }

.log-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.log-badge {
  padding: 2px 10px; border-radius: 12px;
  font-size: 13px; font-weight: 700; color: #fff;
}
.log-badge.create { background: var(--ok); }
.log-badge.update { background: #1c7ed6; }
.log-badge.delete { background: var(--danger); }
.log-no {
  padding: 2px 9px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.log-buyer { font-size: 18px; font-weight: 700; }
.log-date { font-size: 14px; color: var(--muted); }
.log-spacer { flex: 1; }
.log-time { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

.log-lines { font-size: 15px; color: var(--text-2); line-height: 1.75; }
.log-lines > div { white-space: pre-wrap; }

.log-foot {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 10px; padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 13px; color: var(--muted);
}

.log-detail { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.log-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.log-detail-cap { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.log-detail .table td { padding: 6px 8px; }

@media (max-width: 700px) {
  .log-detail-grid { grid-template-columns: 1fr; }
}

/* ── 悬浮数字键盘 ──────────────────────────────────────── */
/* 点数字输入框时贴着它弹出来，不调系统键盘，省得弹上弹下挡住半屏 */
.keypad {
  position: fixed;
  z-index: 400;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  box-shadow: 0 12px 34px rgba(16, 24, 40, .22), 0 2px 6px rgba(16, 24, 40, .08);
  display: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
.keypad.show { display: block; }

.keypad-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 0 4px 9px;
  font-size: 14px; font-weight: 600; color: var(--muted);
}
.keypad-head .val {
  font-size: 19px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.keypad-head .val:empty::after { content: '—'; color: var(--muted); }

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(4, 64px);
  grid-auto-rows: 56px;
  gap: 8px;
}
.keypad-grid button {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: 600 25px/1 -apple-system, "PingFang SC", sans-serif;
  cursor: pointer;
  padding: 0;
  transition: background .08s, transform .06s;
}
.keypad-grid button:active { background: var(--primary-weak); border-color: var(--primary); transform: scale(.95); }

.keypad-grid button[data-k="back"]  { font-size: 23px; color: var(--text-2); }
.keypad-grid button[data-k="clear"] { font-size: 17px; color: var(--text-2); }
.keypad-grid button[data-k="done"]  {
  background: var(--primary); border-color: var(--primary); color: #fff;
  font-size: 18px; font-weight: 700;
}
.keypad-grid button[data-k="done"]:active { background: var(--primary-dark); }

/* 键盘弹出时，正在编辑的那个输入框高亮一下 */
.input.num.kp-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-weak);
}

@media (max-width: 860px) {
  .keypad-grid { grid-template-columns: repeat(4, 58px); grid-auto-rows: 52px; }
  .keypad-grid button { font-size: 23px; }
}

/* ── 窄屏（竖屏 iPad / 手机）───────────────────────────── */
@media (max-width: 860px) {
  :root { --nav-h: 56px; }
  .nav { padding: 0 10px; gap: 4px; overflow-x: auto; }
  .nav-brand { font-size: 16px; margin-right: 4px; }
  .nav-tab { padding: 0 12px; font-size: 15px; height: 38px; }
  .nav-right .btn { padding: 0 10px; font-size: 14px; min-height: 34px; }
  .wrap { padding: 16px 12px 150px; }

  /* 明细行：规格 + 数量 + 单价 + 金额 + 删除，全部挤在一行里。
     窄屏下规格列收窄，让三个数字框有地方站。 */
  /* 三个数字列必须用 minmax(0, 1fr)。
     光写 1fr 的话，列的隐式最小宽度是内容的 min-content ——
     表头「单价（元/斤）」这种文字会把列撑住，整个页面被顶宽、右边溢出。 */
  .item-head,
  .item-row {
    grid-template-columns: minmax(52px, auto) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 40px;
    gap: 8px;
  }
  .item-head { font-size: 12px; padding: 0 10px 6px; }
  .item-head > div { overflow: hidden; text-overflow: ellipsis; }
  .item-row { padding: 10px; }
  .item-row .spec { font-size: 17px; gap: 5px; }
  .item-row .spec .dot { width: 8px; height: 8px; }
  .item-row .amount { font-size: 18px; }
  .item-row .del { width: 38px; height: 38px; font-size: 19px; }
  .input.num { font-size: 19px; padding: 8px 6px; }

  /* 取整方式：标题一行、三个按钮一行，别折成两行 */
  .spread { flex-wrap: wrap; }
  #roundingTabs { width: 100%; margin-top: 6px; }
  .tab { padding: 0 12px; font-size: 15px; min-height: 42px; flex: 1; }

  .bottombar { flex-wrap: wrap; gap: 10px; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
  .bottombar .totals { gap: 16px; }
  .bottombar .t-value { font-size: 20px; }
  .bottombar .btn-lg { flex: 1; }
}

/* 手机竖屏 / 分屏窄栏：再收一收 */
@media (max-width: 560px) {
  .nav-brand { display: none; }
  .nav-tab { padding: 0 8px; font-size: 13px; }

  .item-head,
  .item-row {
    grid-template-columns: minmax(40px, auto) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 32px;
    gap: 6px;
  }
  .item-row { padding: 8px; }
  .item-row .spec { font-size: 15px; }
  .item-row .spec .dot { display: none; }
  .item-row .amount { font-size: 16px; }
  .item-row .del { width: 32px; height: 32px; font-size: 17px; }
  .input.num { font-size: 17px; padding: 8px 4px; }
  .item-head { font-size: 11px; }

  /* 手机宽度放不下三个按钮，让它换行，别硬挤出去 */
  #roundingTabs { flex-wrap: wrap; }
  .tab { padding: 0 10px; font-size: 13px; min-height: 38px; flex: 0 1 auto; }

  /* 底部合计条：合计占一整行，两个按钮下一行平分 */
  .bottombar .totals { flex: 1 0 100%; gap: 14px; }
  .bottombar .totals > span { white-space: nowrap; }
  .bottombar .t-value { font-size: 19px; }
  .bottombar .btn-lg { flex: 1; min-height: 50px; font-size: 18px; padding: 0 16px; }
}

/* 再窄就把表头单位省掉：「数量（斤）」→「数量」，不然会折成两行 */
@media (max-width: 700px) {
  .item-head { white-space: nowrap; }
  .item-head .u { display: none; }

  /* 单据卡片的按钮挪到下面一行，别把金额挤没 */
  .slip-card { flex-wrap: wrap; }
  .slip-link { flex: 1 0 100%; }
  .slip-actions { flex: 1 0 100%; justify-content: flex-end; }
}
