/* 33工作台 · 样式（浅色主题 / iPad mini 触屏优化） */
:root {
  --primary: #6C4E9A;        /* 排色计划主题色（与 Excel tab 一致） */
  --primary-d: #5a3f81;
  --primary-bg: #F3EFF9;
  --red: #C0392B;
  --red-bg: #FDECEA;
  --orange: #D68910;
  --orange-bg: #FDF2E0;
  --yellow-bg: #FDF6DC;
  --green: #1E8449;
  --green-bg: #E9F7EF;
  --text: #2C3E50;
  --sub: #7F8C8D;
  --card: #F8F9FA;
  --line: #E8EBED;
  --white: #FFFFFF;
  --radius: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, "Segoe UI", sans-serif;
  background: var(--white);
  color: var(--text);
  font-size: 15px;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
}
input, textarea, select { font-family: inherit; -webkit-user-select: text; user-select: text; }
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
svg { width: 20px; height: 20px; flex: none; }

/* ---------- 布局 ---------- */
#app { display: flex; height: 100vh; height: 100dvh; }
#sidebar {
  width: 236px; flex: none; display: flex; flex-direction: column;
  background: var(--white); border-right: 1px solid var(--line);
  padding: 18px 12px calc(14px + var(--safe-b));
}
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#topbar {
  height: 56px; flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--white);
}
.view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
#tabbar { display: none; }

.page { max-width: 960px; margin: 0 auto; padding: 14px 14px 90px; }

/* ---------- 侧栏导航 ---------- */
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.logo-badge {
  width: 38px; height: 38px; border-radius: 10px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px;
}
.logo-t { font-size: 18px; font-weight: 700; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-btn {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px;
  border-radius: 10px; font-size: 15px; color: var(--text); touch-action: manipulation;
  transition: background .15s;
}
.nav-btn:active { background: var(--card); }
.nav-btn.on { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.side-foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--sub); }

/* ---------- 顶栏 ---------- */
.tb-title { font-size: 18px; font-weight: 700; }
.tb-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  color: var(--text); position: relative; touch-action: manipulation;
}
.icon-btn:active { background: var(--card); }
.icon-btn.sm { width: 38px; height: 38px; color: var(--sub); }
.icon-btn.sm.del { color: var(--red); }
.dot {
  position: absolute; top: 6px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--red); color: #fff; border-radius: 9px; font-size: 11px; line-height: 17px; text-align: center;
}

/* ---------- 卡片与通用 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 12px;
}
.btn {
  min-height: 44px; padding: 0 18px; border-radius: 10px; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  touch-action: manipulation; transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.97); opacity: .9; }
.btn.primary { background: var(--primary); color: #fff; font-weight: 600; }
.btn.plain { background: var(--white); border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger-ghost { background: var(--white); border: 1px solid #E6B8B3; color: var(--red); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.danger.arming { background: #8E2A20; }
.btn[disabled] { opacity: .5; }

.chip {
  min-height: 36px; padding: 0 14px; border-radius: 18px; font-size: 13px;
  background: var(--white); border: 1px solid var(--line); color: var(--sub);
  display: inline-flex; align-items: center; touch-action: manipulation;
}
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.link-btn { color: var(--primary); font-size: 13px; padding: 4px 6px; }
.mini-select {
  min-height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--white);
  font-size: 13px; padding: 0 8px; color: var(--text); max-width: 180px;
}
.list-stat { font-size: 12.5px; color: var(--sub); padding: 2px 4px 8px; }

/* ---------- 记录页日期分组（组头吸顶；v2.3.0 可折叠+徽章样式见下方「记录页日期分组」段） ---------- */

/* 表格横向滚动容器（窄屏不撑破卡片） */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.table-wrap .mini-table { min-width: 420px; }

/* ---------- 日期导航 ---------- */
.date-nav { display: flex; align-items: center; gap: 8px; }
.date-center { flex: 1; text-align: center; }
.date-main { font-size: 17px; font-weight: 700; }
.date-sub { font-size: 12px; color: var(--sub); margin-top: 2px; }

/* ---------- 分段控制 ---------- */
.seg { display: flex; gap: 6px; padding: 6px; }
.seg.small { padding: 4px; }
.seg-btn {
  flex: 1; min-height: 40px; border-radius: 8px; font-size: 14px; color: var(--sub);
  display: flex; align-items: center; justify-content: center; gap: 6px; touch-action: manipulation;
}
.seg-btn.on { background: var(--primary); color: #fff; font-weight: 600; }

/* ---------- 快速录入 ---------- */
.quick-add .qa-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.quick-add .qa-row:last-of-type { margin-bottom: 0; }
.qa-sel, .qa-num {
  min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--white);
  font-size: 15px; padding: 0 10px; color: var(--text); flex: 1 1 120px; min-width: 0;
}
.qa-num { flex: 1 1 130px; }
.qa-hint { font-size: 12px; color: var(--sub); margin-top: 8px; }

/* ---------- 筛选栏 ---------- */
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.filters .f-row { margin-top: 10px; }
.filters .f-row:first-of-type { margin-top: 0; }
.f-selects { display: flex; gap: 8px; flex-wrap: wrap; }
.search-box {
  flex: 1; display: flex; align-items: center; gap: 8px; background: var(--white);
  border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; min-height: 44px;
}
.search-box svg { color: var(--sub); }
.search-box input { flex: 1; border: none; outline: none; font-size: 15px; background: transparent; }

/* ---------- 任务列表 ---------- */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task {
  display: flex; align-items: flex-start; gap: 10px; background: var(--white);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
  touch-action: manipulation;
}
.task:active { background: #FAFAFC; }
.task.done { opacity: .62; }
.task.done .task-title { text-decoration: line-through; }
.task.bad-pair { background: var(--red-bg); border-color: #F2C9C4; }
.chk {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid #C9CDD1; flex: none; margin-top: 2px;
  display: flex; align-items: center; justify-content: center; color: #fff; touch-action: manipulation;
}
.chk svg { width: 16px; height: 16px; }
.chk.on { background: var(--green); border-color: var(--green); }
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.task-meta { font-size: 12.5px; color: var(--sub); margin-top: 3px; }
.task-note { font-size: 12.5px; color: var(--sub); margin-top: 4px; }
.color-tag {
  font-size: 11px; font-weight: 400; background: var(--primary-bg); color: var(--primary);
  border-radius: 6px; padding: 1px 7px;
}
.color-tag.none { background: var(--yellow-bg); color: #9A7D0A; }
.qty-tag {
  font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-bg);
  border-radius: 6px; padding: 1px 8px;
}
.qty-tag.amt { color: var(--green); background: var(--green-bg); }
.pbar { height: 6px; background: var(--line); border-radius: 3px; margin-top: 7px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.badge {
  font-size: 11px; border-radius: 6px; padding: 2px 7px; display: inline-flex; align-items: center; gap: 3px;
  background: var(--card); color: var(--sub);
}
.badge svg { width: 12px; height: 12px; }
.badge.due-over { background: var(--red-bg); color: var(--red); font-weight: 600; }
.badge.due-soon { background: var(--orange-bg); color: var(--orange); font-weight: 600; }
.badge.due-ok { background: var(--card); color: var(--sub); }
.badge.throw { background: var(--green-bg); color: var(--green); }
.badge.reweld { background: var(--red-bg); color: var(--red); font-weight: 600; }
.badge.transfer { background: var(--primary-bg); color: var(--primary); }
.badge.pair-warn { background: var(--red-bg); color: var(--red); }
/* ---------- 导出提醒（v2.3.0：周一早 8 点，导出后自动隐藏） ---------- */
.exp-dot {
  position: absolute; top: 8px; right: 6px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--red); display: none; pointer-events: none;
}
.icon-btn.has-dot .exp-dot { display: block; animation: pulse-dot 1.2s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: .7; } }
.exp-banner {
  display: none; align-items: center; gap: 10px; flex: none;
  background: #FDEBD0; border-bottom: 1px solid #F2D9A8; color: #8A6D0B;
  padding: 9px 14px; font-size: 13.5px; font-weight: 600;
}
.exp-banner .eb-ic { display: inline-flex; color: var(--orange); }
.exp-banner .eb-ic svg { width: 17px; height: 17px; }
.exp-banner .eb-text { flex: 1; min-width: 0; }
.exp-banner .btn { min-height: 34px; padding: 0 12px; font-size: 12.5px; }

/* ---------- 记录页日期分组（v2.3.0：可折叠 + 组头状态徽章） ---------- */
.rec-head {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  background: #EFF1F4; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 12px; margin: 14px 0 8px; font-size: 13px;
  cursor: pointer; touch-action: manipulation;
}
.rec-head:active { background: #E7EAEE; }
.task-list > .rec-head:first-child { margin-top: 0; }
.rec-fold { flex: none; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; color: var(--sub); }
.rec-fold svg { width: 14px; height: 14px; transition: transform .15s; }
.rec-head.open .rec-fold svg { transform: rotate(180deg); }
.rec-date { font-weight: 700; color: var(--text); flex: none; }
.rec-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0; }
.rec-stat { color: var(--sub); font-size: 12px; text-align: right; flex: none; margin-left: auto; }
.rec-body { display: flex; flex-direction: column; gap: 8px; }
/* 排色保存后跳到出货页的高亮行 */
@keyframes flash-row {
  0%, 100% { background: var(--card); }
  30% { background: var(--primary-bg); }
}
/* 汇总页：待办卡 / 折叠明细 / 数字副行（v2.2） */
.todo-block { padding-bottom: 8px; }
.todo-grid { display: flex; gap: 10px; margin-top: 8px; }
.todo-item {
  flex: 1; display: flex; align-items: center; gap: 10px; border-radius: 10px; padding: 10px 12px;
  background: var(--card); border: 1px solid var(--line);
}
.todo-item.warn { background: #FFF7E8; border-color: #F2D9A8; }
.todo-item.ok { background: var(--green-bg); border-color: #C7E6D0; }
.todo-n { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1; }
.todo-item.warn .todo-n { color: var(--orange); }
.todo-item.ok .todo-n { color: var(--green); }
.todo-l { font-size: 12px; color: var(--sub); line-height: 1.45; }
.fold-wrap { display: block; }
.fold { padding: 0; overflow: hidden; }
.fold > summary.fold-t {
  list-style: none; cursor: pointer; padding: 12px 14px; font-size: 14px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; touch-action: manipulation;
}
.fold > summary.fold-t::-webkit-details-marker { display: none; }
.fold > summary.fold-t::after { content: '＋'; color: var(--sub); font-weight: 400; }
.fold[open] > summary.fold-t::after { content: '－'; }
.fold .fold-b { padding: 0 14px 12px; }
.sec-t { font-size: 13px; font-weight: 600; color: var(--sub); margin: 16px 2px 8px; }
.block-t svg { width: 15px; height: 15px; vertical-align: -2px; }
.stat-s { font-size: 11px; color: var(--sub); margin-top: 2px; line-height: 1.35; }

.dye-stat { font-size: 13px; color: var(--sub); background: var(--card); border-radius: 8px; padding: 8px 12px; margin: 4px 0 10px; }
.dye-stat b { color: var(--primary); }
.batch-tag {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px;
  background: var(--primary-bg); color: var(--primary); font-size: 12px; font-weight: 600;
}
/* 出货记录的来源批次行（回答「这 200 和 400 是不是同一批 600」） */
.trace-line {
  display: flex; align-items: flex-start; gap: 6px; font-size: 12.5px; color: var(--primary);
  background: var(--primary-bg); border-radius: 7px; padding: 5px 9px; margin-top: 6px; line-height: 1.5;
}
.trace-line b { font-weight: 700; }
.trace-line svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.trace-line.plain { color: var(--sub); background: var(--card); }
/* 记录页：搜索常显 + 筛选入口 + 已选条件标签 */
.filters .search-row { display: flex; gap: 8px; align-items: stretch; margin-top: 10px; }
.filters .search-row .search-box { flex: 1; }
.filter-btn { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }
.filter-btn svg { width: 15px; height: 15px; }
.filter-chips { margin-top: 10px; }
.chip.x { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary); }
.chip.x i { font-style: normal; opacity: .7; font-size: 14px; }
.kind-tag {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 6px;
  background: var(--card); color: var(--sub); font-size: 11.5px;
}
.src-tag { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--sub); background: var(--card); border-radius: 8px; padding: 8px 12px; }
.src-tag svg { width: 15px; height: 15px; }
.task-acts { display: flex; flex-direction: column; gap: 4px; flex: none; }
.dye-prog { font-size: 11.5px; color: var(--primary); font-weight: 600; }
.filter-sels { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-sels .mini-select { flex: 1 1 130px; min-width: 0; }

/* ---------- 出货页：按客户方+型号分组、组内按颜色聚合（v2.2.1） ---------- */
.grp-list { display: flex; flex-direction: column; gap: 10px; }
.grp { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.grp-t {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  background: var(--card); cursor: pointer; touch-action: manipulation;
}
.grp-t:active { background: #F1F3F5; }
.grp-fold {
  width: 34px; height: 34px; flex: none; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; color: var(--sub);
}
.grp-fold svg { width: 16px; height: 16px; transition: transform .15s; }
.grp.folded .grp-fold svg { transform: rotate(-90deg); }
.grp-main { flex: 1; min-width: 0; }
.grp-title { font-size: 15px; font-weight: 700; }
.grp-meta { font-size: 12px; color: var(--sub); margin-top: 2px; }
.grp .pbar { margin-top: 6px; }
.grp-b { border-top: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.crow {
  display: flex; align-items: center; gap: 10px; background: var(--white);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; touch-action: manipulation;
}
.crow:active { background: #FAFAFC; }
.crow-main { flex: 1; min-width: 0; }
.crow-t { font-size: 14px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.crow-meta { font-size: 12px; color: var(--sub); margin-top: 3px; }
.crow .caret { display: inline-flex; margin-left: 2px; }
.crow .caret svg { width: 13px; height: 13px; transition: transform .15s; }
.crow.open .caret svg { transform: rotate(180deg); }
.batch-list {
  display: flex; flex-direction: column; gap: 6px; margin: 6px 2px 2px;
  padding-left: 10px; border-left: 2px solid var(--primary-bg);
}
.btask {
  display: flex; align-items: center; gap: 10px; background: var(--card);
  border-radius: 9px; padding: 8px 10px; touch-action: manipulation;
}
.btask-main { flex: 1; min-width: 0; }
.btask-t { font-size: 13.5px; font-weight: 600; }
.btask-meta { font-size: 12px; color: var(--sub); margin-top: 2px; }
/* ---------- 备注高亮行（v2.3.1：计划/进货备注在列表里直接可见，不用点开计划） ---------- */
.note-line {
  display: flex; align-items: flex-start; gap: 5px;
  font-size: 12.5px; color: #8A6D0B; background: var(--yellow-bg);
  border: 1px solid #F2E3B0; border-radius: 7px; padding: 5px 9px; margin-top: 6px; line-height: 1.5;
}
.note-line svg { width: 13px; height: 13px; flex: none; margin-top: 2px; }
.badge.note-cnt { background: var(--yellow-bg); color: #9A7D0A; }
.badge.note-cnt svg { width: 12px; height: 12px; }

.task.flash, .crow.flash, .btask.flash { animation: flash-row 1.6s ease-out 2; }
.badge.pair-warn { background: var(--red-bg); color: var(--red); }

.empty { text-align: center; padding: 46px 20px; color: var(--sub); }
.empty svg { width: 42px; height: 42px; opacity: .35; }
.empty-t { font-size: 15px; margin-top: 10px; color: var(--text); }
.empty-s { font-size: 12.5px; margin-top: 4px; }

/* ---------- 往日未完成 ---------- */
.overdue { background: var(--yellow-bg); border-color: #EADFA8; }
.overdue-head { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #8A6D0B; }
.overdue-head svg { width: 18px; height: 18px; }
.overdue-head .link-btn { margin-left: auto; color: #8A6D0B; }
.overdue-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- 汇总页 ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-bottom: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px; text-align: center; }
.stat-v { font-size: 19px; font-weight: 700; color: var(--primary); }
.stat-l { font-size: 12px; color: var(--sub); margin-top: 2px; }
.block-t { font-size: 14px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.block-t svg { width: 17px; height: 17px; color: var(--primary); }
.block-empty { font-size: 13px; color: var(--sub); padding: 12px 0; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th {
  text-align: left; font-weight: 600; color: var(--sub); font-size: 12px;
  padding: 7px 8px; border-bottom: 1px solid var(--line); background: var(--white);
}
.mini-table td { padding: 8px; border-bottom: 1px solid var(--line); background: var(--white); }
.mini-table tr:nth-child(even) td { background: #FBFCFE; }
.mini-table tbody tr:last-child td { border-bottom: none; }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input { flex: 1; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; font-size: 15px; background: var(--white); }
.range-sep { color: var(--sub); }
.export-card .export-t { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.export-card .export-t svg { color: var(--primary); }
.export-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.export-btns .btn { flex: 1; min-width: 140px; }

/* ---------- 设置页 ---------- */
.base-group { margin-bottom: 14px; }
.base-t { font-size: 13px; font-weight: 700; color: var(--sub); margin-bottom: 7px; }
.base-count { font-weight: 400; color: var(--sub); }
.base-items { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.base-tag, .pair-tag {
  display: inline-flex; align-items: center; gap: 5px; font-size: 13px; background: var(--white);
  border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; min-height: 32px;
}
.base-x, .pair-x { color: var(--sub); font-size: 14px; line-height: 1; padding: 2px 3px; }
.base-x:active, .pair-x:active { color: var(--red); }
.base-add-inline { display: inline-flex; gap: 5px; }
.base-add-inline input {
  width: 92px; min-height: 32px; border: 1px dashed #C9CDD1; border-radius: 7px; padding: 0 8px; font-size: 13px; background: var(--white);
}
.base-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--sub); margin: 10px 0; }
.pairs-box { display: flex; flex-wrap: wrap; gap: 6px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: none; }
.set-label { font-size: 14.5px; font-weight: 600; }
.set-sub { font-size: 12px; color: var(--sub); margin-top: 2px; }
.about { font-size: 12.5px; color: var(--sub); line-height: 1.8; }

/* ---------- 悬浮按钮 ---------- */
#fab { position: fixed; right: 18px; bottom: calc(20px + var(--safe-b)); z-index: 30; }
.fab-btn {
  width: 58px; height: 58px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(108, 78, 154, .38);
  touch-action: manipulation; transition: transform .12s;
}
.fab-btn:active { transform: scale(.92); }
.fab-btn svg { width: 26px; height: 26px; }

/* ---------- 弹窗 / 底部表单 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(15, 20, 30, .45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  opacity: 0; transition: opacity .2s;
}
.mask.show { opacity: 1; }
.dialog {
  width: 100%; max-width: 380px; background: var(--white); border-radius: 16px; padding: 22px 20px 16px;
  transform: translateY(12px); transition: transform .2s;
}
.mask.show .dialog { transform: none; }
.dlg-title { font-size: 17px; font-weight: 700; }
.dlg-text { font-size: 13.5px; color: var(--sub); margin-top: 10px; line-height: 1.6; }
.dlg-btns { display: flex; gap: 10px; margin-top: 18px; }
.dlg-btns .btn { flex: 1; }
.dlg-hint { font-size: 12px; color: var(--red); margin-top: 10px; min-height: 16px; text-align: center; }

.sheet-mask { align-items: flex-end; padding: 0; }
.sheet {
  width: 100%; max-width: 640px; max-height: 92vh; background: var(--white);
  border-radius: 20px 20px 0 0; padding: 8px 18px calc(18px + var(--safe-b));
  transform: translateY(40px); transition: transform .22s; overflow-y: auto;
}
.mask.show .sheet { transform: none; }
.sheet-grab { width: 40px; height: 5px; border-radius: 3px; background: #D5D9DC; margin: 4px auto 12px; }
.form-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.form-title.sub { margin-top: 16px; font-size: 14px; color: var(--sub); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--sub); }
.form-row input, .form-row select {
  min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px;
  font-size: 15px; background: var(--white); color: var(--text); width: 100%;
}
.sheet-body textarea, .sheet-body input[type="datetime-local"] {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px;
  font-size: 15px; background: var(--white); color: var(--text); resize: none;
}
.form-warn {
  display: flex; align-items: flex-start; gap: 7px; margin-top: 10px; font-size: 12.5px;
  background: var(--yellow-bg); border: 1px solid #EADFA8; color: #8A6D0B; border-radius: 9px; padding: 9px 11px;
}
.form-warn svg { width: 16px; height: 16px; margin-top: 1px; }
.sheet-btns { display: flex; gap: 10px; margin-top: 18px; }
.sheet-btns .btn { flex: 1; }

/* ---------- 提醒横幅 ---------- */
#banner-root { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 120; width: min(560px, calc(100% - 20px)); display: flex; flex-direction: column; gap: 8px; }
.remind-banner {
  background: var(--primary); color: #fff; border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 10px 28px rgba(108, 78, 154, .4); display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  transform: translateY(-16px); opacity: 0; transition: all .25s;
}
.remind-banner.show { transform: none; opacity: 1; }
.rb-main { flex: 1; min-width: 200px; }
.rb-title { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.rb-title svg { width: 17px; height: 17px; }
.rb-sub { font-size: 12px; opacity: .85; margin-top: 3px; }
.rb-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.rb-btns .btn { min-height: 34px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; background: rgba(255, 255, 255, .18); color: #fff; }
.rb-btns .btn.plain { background: transparent; border: 1px solid rgba(255, 255, 255, .4); }

/* ---------- 轻提示 ---------- */
#toast-root { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-b)); z-index: 130; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: rgba(30, 38, 48, .92); color: #fff; font-size: 13.5px; border-radius: 10px;
  padding: 10px 16px; opacity: 0; transform: translateY(8px); transition: all .25s; max-width: 80vw;
}
.toast.show { opacity: 1; transform: none; }

/* ---------- 底部 Tab（<1200px）：iPad 竖屏744 / 横屏1133 / 桌面网站模式1024 / 手机 全覆盖 ---------- */
@media (max-width: 1199px) {
  #sidebar { display: none; }
  #tabbar {
    display: flex; flex: none; background: var(--white); border-top: 1px solid var(--line);
    padding: 4px 8px calc(4px + var(--safe-b));
  }
  #tabbar .nav-btn {
    flex: 1; flex-direction: column; gap: 3px; min-height: 52px; font-size: 11.5px; padding: 0 4px;
  }
  .page { padding-bottom: 110px; }
  #fab { bottom: calc(76px + var(--safe-b)); }
  #toast-root { bottom: calc(150px + var(--safe-b)); }
  .form-grid { grid-template-columns: 1fr; }
}
@media (min-width: 1200px) {
  #fab { bottom: 24px; }
}

/* ---------- 手机窄屏（≤480px）收紧 ---------- */
@media (max-width: 480px) {
  body { font-size: 14px; }
  .page { padding: 10px 10px 100px; }
  .card { padding: 10px 12px; margin-bottom: 10px; border-radius: 10px; }
  #topbar { height: 52px; padding: 0 10px; }
  .tb-title { font-size: 16px; }
  .date-main { font-size: 15px; }
  .seg-btn { min-height: 38px; font-size: 13px; }
  .qa-row { gap: 6px; }
  .qa-sel { flex: 1 1 44%; min-height: 42px; font-size: 14px; }
  .qa-num { flex: 1 1 100%; }
  .quick-add .qa-row:last-child { flex-wrap: nowrap; }
  .quick-add .qa-row:last-child .qa-num { flex: 1 1 auto; }
  .qa-hint { font-size: 11.5px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .mini-select { max-width: none; flex: 1 1 44%; }
  .f-selects .mini-select { flex: 1 1 44%; }
  .rec-head { font-size: 12px; padding: 7px 10px; flex-wrap: wrap; }
  .rec-stat { font-size: 11px; }
  .rec-badges { order: 3; flex-basis: 100%; }
  .exp-banner { padding: 8px 10px; font-size: 12.5px; gap: 8px; }
  .exp-banner .eb-text { font-size: 12.5px; }
  .btask { flex-wrap: wrap; }
  .btask .btn.small { min-height: 34px; }
  .task { padding: 10px; gap: 8px; }
  .task-title { font-size: 14px; }
  .grp-t { padding: 10px; gap: 8px; }
  .grp-title { font-size: 14px; }
  .grp-fold { width: 30px; height: 30px; }
  .crow { padding: 8px; gap: 8px; }
  .crow-t { font-size: 13px; }
  .btask { padding: 7px 9px; }
  .stat-row { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .stat { padding: 8px 4px; }
  .stat-v { font-size: 16px; }
  .stat-l { font-size: 11px; }
  .mini-table { font-size: 12px; }
  .mini-table th, .mini-table td { padding: 6px 6px; }
  .export-btns .btn { min-width: 120px; font-size: 14px; }
  .list-stat { font-size: 11.5px; }
  .set-row { flex-wrap: wrap; }
  .dialog { padding: 18px 16px 12px; }
  .form-grid { gap: 8px; }
  #banner-root { top: 6px; }
  .remind-banner { padding: 10px 12px; }
}
