/* ============================================================
   「报销」模块 —— 整屏页面样式
   风格：白卡 + 系统分组灰底 + iOS 蓝操作 + 琥珀待办 + 绿色已报销
   所有选择器统一 rb- 前缀，与既有记账页样式隔离、互不覆盖。
   ============================================================ */

/* ---------- 全局容器：整屏覆盖，原记账页不留在下面 ---------- */

.rb-app {
  position: fixed;
  inset: 0 0 auto;
  height:calc(100dvh - var(--nav-h) - env(safe-area-inset-bottom));
  z-index: 70;
  display: flex;
  flex-direction: column;
  background: #f2f2f7;
  color: #16181d;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
    'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

body.rb-open {
  overflow: hidden;
}
body.rb-open > .nav {
  display:grid;
  z-index:80;
  bottom:var(--rb-keyboard-bottom,0px);
}

/* ---------- 顶部导航 ---------- */

.rb-nav {
  flex: none;
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 6px 12px;
  padding-top: calc(6px + env(safe-area-inset-top));
  background: rgba(242, 242, 247, 0.96);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid #e4e7ee;
}

.rb-back {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  min-height: 34px;
  padding: 0 8px 0 2px;
  border: 0;
  background: transparent;
  color: #2f6bff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.rb-back-chev {
  font-size: 19px;
  line-height: 1;
  margin-top: -1px;
}

.rb-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rb-nav-right {
  flex: none;
  min-width: 62px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}
.rb-nav-btn {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #e4e7ee;
  border-radius: 999px;
  background: #fff;
  color: #2f6bff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* 模块首屏的顶栏：与其他页面同一套（左侧「‹ 返回记账」+ 中间标题） */
.rb-nav.rb-nav-root {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rb-back-exit {
  font-weight: 600;
}

/* ---------- 分段控件 ---------- */

.rb-seg {
  display: flex;
  gap: 2px;
  padding: 2px;
  margin: 8px 4px 0;
  background: #e9e9ee;
  border-radius: 9px;
}
.rb-seg button {
  flex: 1;
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #3c4149;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}
.rb-seg button.active {
  background: #fff;
  color: #16181d;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
}

.rb-tabs {
  display: flex;
  gap: 18px;
  padding: 12px 16px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.rb-tabs::-webkit-scrollbar { display: none; }
.rb-tabs button {
  flex: none;
  border: 0;
  background: transparent;
  padding: 0 0 6px;
  color: #6b7280;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
}
.rb-tabs button.active {
  color: #16181d;
  border-bottom-color: #2f6bff;
}

/* ---------- 主体滚动区 ---------- */

.rb-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 0 96px;
}
.rb-body.rb-body-plain { padding-bottom: 24px; }

.rb-pad { padding: 0 16px; }

.rb-sec {
  margin: 18px 16px 7px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rb-sec:first-child { margin-top: 6px; }
.rb-sec-link {
  color: #2f6bff;
  font-weight: 500;
  font-size: 13px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

/* ---------- 卡片 ---------- */

.rb-card {
  margin: 0 16px 12px;
  padding: 14px 16px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.rb-card-flush { padding: 0; overflow: hidden; }

.rb-kpi-row {
  display: flex;
  gap: 10px;
  margin: 0 16px 12px;
}
.rb-kpi {
  flex: 1;
  padding: 13px 14px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.rb-kpi-label {
  font-size: 12.5px;
  color: #6b7280;
}
.rb-kpi-value {
  margin-top: 3px;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}
.rb-kpi-value .rb-cur { font-size: 14px; font-weight: 600; margin-right: 1px; }
.rb-kpi-value .rb-unit { font-size: 13px; font-weight: 600; color: #6b7280; margin-left: 2px; }
.rb-kpi-warn .rb-kpi-value { color: #b25e09; }

/* ---------- 列表行（分组白卡内） ---------- */

.rb-group {
  margin: 0 16px 12px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.rb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 10px 16px;
  border: 0;
  border-top: 1px solid #f0f1f4;
  background: #fff;
  color: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
.rb-group > .rb-row:first-child,
.rb-group > button.rb-row:first-child,
.rb-group > div.rb-row:first-child { border-top: 0; }
.rb-row-static { cursor: default; }
.rb-row-main { flex: 1; min-width: 0; }
.rb-row-label { color: #16181d; }
.rb-row-sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rb-row-value {
  flex: none;
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.rb-row-note { flex: none; font-size: 13px; color: #6b7280; }
.rb-row-note.rb-warn { color: #b25e09; font-weight: 650; }
.rb-chev { flex: none; color: #c3c8d2; font-size: 17px; margin-left: 2px; }
.rb-dot {
  flex: none;
  width: 7px;
  height: 7px;
  margin-left: 2px;
  border-radius: 50%;
  background: #e5484d;
}

.rb-row-amount {
  flex: none;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- 金额大字 ---------- */

.rb-amount {
  margin: 2px 0 4px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
}
.rb-amount .rb-cur { font-size: 20px; font-weight: 600; margin-right: 2px; }
.rb-amount-sub { font-size: 12.5px; color: #6b7280; }

/* ---------- 状态徽标 ---------- */

.rb-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.rb-chip-pending { background: #fdf3e2; color: #b7791f; }
.rb-chip-returned { background: #fdecec; color: #c0392b; }
.rb-chip-pay { background: #e9f0ff; color: #2f6bff; }
.rb-chip-done { background: #e9f8ef; color: #12a150; }
.rb-chip-withdrawn { background: #f0f1f4; color: #6b7280; }
.rb-chip-overdue { background: #fdf3e2; color: #b25e09; }

/* ---------- 表单行 ---------- */

.rb-field {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-top: 1px solid #f0f1f4;
  background: #fff;
}
.rb-group > .rb-field:first-child { border-top: 0; }
.rb-field-label { flex: none; color: #16181d; font-size: 15px; }
.rb-field-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  min-height: 50px;
  border: 0;
  background: transparent;
  color: #16181d;
  font-size: 15px;
  text-align: right;
  outline: none;
}
.rb-field-input::placeholder { color: #a8b0bd; }
.rb-field-value { flex: 1; text-align: right; font-size: 15px; color: #16181d; }
.rb-field-static { color: #6b7280; }
.rb-field-arrow { position: relative; }
.rb-field-arrow > input[type='date'] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  background: transparent;
  font-size: 16px;
}
.rb-field-amount .rb-field-input {
  font-size: 22px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.rb-textarea {
  width: 100%;
  min-height: 74px;
  padding: 12px 16px;
  border: 0;
  background: #fff;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  outline: none;
}
.rb-textarea::placeholder { color: #a8b0bd; }

.rb-hint {
  padding: 7px 16px 0;
  font-size: 12px;
  color: #98a1b0;
}
.rb-hint-warn { color: #b25e09; }

/* 单选框样式（无凭证） */
.rb-check {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 50px;
  padding: 0 16px;
  border-top: 1px solid #f0f1f4;
  background: #fff;
  cursor: pointer;
}
.rb-check-box {
  flex: none;
  width: 21px;
  height: 21px;
  border: 1.5px solid #c9cfd9;
  border-radius: 6px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  line-height: 1;
}
.rb-check.on .rb-check-box { background: #2f6bff; border-color: #2f6bff; }
.rb-check-text { font-size: 15px; }

/* 多选（确认报销勾选） */
.rb-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 10px 16px;
  border-top: 1px solid #f0f1f4;
  background: #fff;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  text-align: left;
  font-size: 15px;
  cursor: pointer;
}
.rb-group > .rb-pick:first-child { border-top: 0; }
.rb-pick-main { flex: 1; min-width: 0; }
.rb-pick-name { font-size: 15px; }
.rb-pick-sub { margin-top: 2px; font-size: 12.5px; color: #6b7280; }
.rb-pick-amount { flex: none; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- 凭证缩略图 ---------- */

.rb-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
}
.rb-thumb {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid #e4e7ee;
  background: #f7f8fb;
  padding: 0;
  cursor: pointer;
}
.rb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rb-thumb-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 21px;
  height: 21px;
  border: 0;
  border-radius: 50%;
  background: rgba(22, 24, 29, 0.66);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.rb-thumb-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 84px;
  height: 84px;
  /* 项目 UI 规则明确禁止虚线边框 —— 用 1px 实线发丝线，与全站分隔线同一套观感 */
  border: 1px solid #e5e6eb;
  border-radius: 9px;
  background: #fff;
  color: #2f6bff;
  font-size: 24px;
  font-weight: 300;
  cursor: pointer;
}
.rb-thumb-add span { font-size: 11px; color: #6b7280; font-weight: 400; }
.rb-thumb-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  border: 1px solid #e4e7ee;
  border-radius: 9px;
  background: #f7f8fb;
  color: #98a1b0;
  font-size: 12px;
}
.rb-thumb-version {
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 1px 5px;
  background: rgba(22, 24, 29, 0.6);
  color: #fff;
  font-size: 10.5px;
  border-top-right-radius: 6px;
}

/* ---------- 底部主操作按钮 ---------- */

.rb-footer {
  flex: none;
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: rgba(242, 242, 247, 0.97);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid #e4e7ee;
}
.rb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 650;
  cursor: pointer;
}
.rb-btn-primary { background: #2f6bff; color: #fff; }
.rb-btn-primary:disabled { background: #b9c7e8; color: #eef2fb; }
.rb-btn-ghost { background: #fff; color: #2f6bff; border: 1px solid #d7dded; }
.rb-btn-danger { background: #fff; color: #e5484d; border: 1px solid #f3d3d4; }
.rb-btn-row { display: flex; gap: 10px; }

/* ---------- 环形图 / 构成条 ---------- */

.rb-chart {
  width: 100%;
  height: 210px;
  position: relative;
}
.rb-legend {
  margin: 0 16px 12px;
  padding: 4px 0 0;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.rb-legend-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 16px;
  border-top: 1px solid #f0f1f4;
  font-size: 14px;
}
.rb-legend-row:first-child { border-top: 0; }
.rb-swatch {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.rb-legend-name { flex: 1; min-width: 0; }
.rb-legend-amt { flex: none; font-variant-numeric: tabular-nums; font-weight: 600; }
.rb-legend-pct { flex: none; width: 52px; text-align: right; color: #6b7280; font-variant-numeric: tabular-nums; }

.rb-stack {
  display: flex;
  gap: 2px;
  height: 12px;
  margin-top: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: #eef0f4;
}
.rb-stack-seg { height: 100%; }
.rb-store-row {
  padding: 13px 16px;
  border-top: 1px solid #f0f1f4;
  background: #fff;
}
.rb-group > .rb-store-row:first-child { border-top: 0; }
.rb-store-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.rb-store-name { font-size: 15px; font-weight: 600; }
.rb-store-amount { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rb-store-detail {
  margin-top: 7px;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.6;
  word-break: break-word;
}
.rb-store-detail b { color: #3c4149; font-weight: 600; }

/* ---------- 空状态 ---------- */

.rb-empty {
  margin: 40px 16px;
  padding: 34px 20px;
  text-align: center;
  color: #98a1b0;
  font-size: 14px;
  background: #fff;
  border-radius: 12px;
}
.rb-empty-icon { display: block; font-size: 26px; margin-bottom: 8px; opacity: 0.55; }

/* ---------- 凭证查看（整屏） ---------- */

.rb-voucher-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #0d0f13;
}
.rb-voucher-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: auto;
}
.rb-voucher-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
}
.rb-voucher-bar {
  flex: none;
  padding: 8px 16px calc(10px + env(safe-area-inset-bottom));
  background: #0d0f13;
  color: #e7eaf0;
}
.rb-voucher-meta { font-size: 12.5px; color: #9aa3b5; text-align: center; }
.rb-voucher-nav {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.rb-voucher-nav button {
  flex: 1;
  min-height: 42px;
  border: 1px solid #2a2f39;
  border-radius: 10px;
  background: #171b22;
  color: #e7eaf0;
  font-size: 14px;
  cursor: pointer;
}
.rb-voucher-nav button:disabled { opacity: 0.4; }

/* ---------- 时间线（处理记录 / 修改记录） ---------- */

.rb-tl {
  margin: 0 16px 12px;
  padding: 6px 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.rb-tl-item {
  display: flex;
  gap: 10px;
  padding: 11px 16px;
  border-top: 1px solid #f0f1f4;
}
.rb-tl-item:first-child { border-top: 0; }
.rb-tl-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: #c3c8d2;
}
.rb-tl-dot.rb-tl-ok { background: #12a150; }
.rb-tl-dot.rb-tl-warn { background: #b7791f; }
.rb-tl-dot.rb-tl-danger { background: #e5484d; }
.rb-tl-dot.rb-tl-blue { background: #2f6bff; }
.rb-tl-main { flex: 1; min-width: 0; }
.rb-tl-title { font-size: 14.5px; }
.rb-tl-sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: #6b7280;
  word-break: break-word;
}
.rb-tl-when { flex: none; font-size: 12px; color: #98a1b0; }

.rb-diff {
  margin-top: 5px;
  padding: 7px 9px;
  border-radius: 7px;
  background: #f7f8fb;
  font-size: 12.5px;
  color: #3c4149;
  word-break: break-word;
}
.rb-diff-line { display: flex; gap: 6px; }
.rb-diff-old { color: #b42318; text-decoration: line-through; }
.rb-diff-new { color: #12a150; font-weight: 600; }

/* ---------- 轻提示（复用全局 #toast 元素） ---------- */

.rb-loading {
  padding: 28px 16px;
  text-align: center;
  color: #98a1b0;
  font-size: 14px;
}

.rb-inline-error {
  margin: 0 16px 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fdecec;
  color: #b42318;
  font-size: 13px;
}

/* ============================================================
   底部导航：新增「报销」入口（本文件在 style.css 之后加载，故可直接覆盖）
   —— 老板 4 项（设备/记账/统计/报销），店长 3 项（记账/统计/报销）
   ============================================================ */

.nav {
  grid-template-columns: repeat(4, 1fr);
}
body.role-manager .nav {
  grid-template-columns: repeat(3, minmax(0, 150px));
}

/* 角标：待办数量（老板 = 待审核 + 待报销；店长 = 待报销）。
   2026-10-07 用户追加要求：记账／出租页那一行「报销」入口已删除，
   待办提醒**统一集中显示在这个底部入口旁**。
   规则：
     · 有 1 件显示 1，有 2 件显示 2，依此类推；
     · **多位数字完整显示**，不截断成99+，不改成纯红点；
     · 0 件时由 JS 加 .hidden 隐藏，不显示 0；
     · 红底白字，保证数字清晰可读。 */
.nav button {
  position: relative;
}
.rb-nav-badge {
  position: absolute;
  top: 2px;
  left: 50%;
  margin-left: 4px;
  /* 多位数字要放得下：min-width给最小值，padding 随内容增长，
     配合 white-space: nowrap 保证「123」这类不被挤成两行或省略号。 */
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  box-sizing: border-box;
  border-radius: 999px;
  background: #e03131;          /* 红底 */
  color: #fff;/* 白字 */
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 1.5px #fff;  /* 与导航底色分隔，避免压在图标上读不清 */
  pointer-events: none;           /* 不挡住导航按钮的点击 */
}
/* .hidden 是全局规则（style.css 里 display:none !important），此处不重复定义。 */

.rb-root-spacer { width:64px; flex:none; }
.rb-nav-root .rb-nav-right { width:64px; flex:none; }
.rb-app { overflow:hidden; overscroll-behavior:contain; }
.rb-body { overscroll-behavior:contain; }
