/* 便利店会员赊账管理系统 · 移动端 H5 样式 */

:root {
  --main: #1f7a5a;
  --main-dark: #166349;
  --main-light: #e8f4ef;
  --red: #d9463f;
  --red-light: #fdeceb;
  --text: #23272e;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --line: #eceff3;
  --bg: #f4f6f8;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

input, select, button, textarea { font-family: inherit; font-size: 16px; }
button { cursor: pointer; border: none; background: none; }

/* ============ 布局 ============ */
#app { max-width: 720px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; }

.hdr {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 12px;
  background: var(--main); color: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .12);
}
.hdr-title { font-size: 17px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr .back { color: #fff; font-size: 24px; line-height: 1; padding: 0 6px 2px 0; }
.hdr-shop {
  background: rgba(255, 255, 255, .18); color: #fff; border: none;
  border-radius: 6px; padding: 4px 6px; font-size: 13px; max-width: 130px;
}
.hdr-shop option { color: #23272e; }
.hdr-user { font-size: 13px; opacity: .92; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.body { padding: 12px 12px 76px; }

.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 100%; max-width: 720px; z-index: 30;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; text-align: center; padding: 8px 0 9px;
  color: var(--text-3); text-decoration: none; font-size: 11px;
}
.tabbar a .ic { display: block; font-size: 19px; line-height: 1.25; }
.tabbar a.on { color: var(--main); font-weight: 600; }

/* ============ 卡片 ============ */
.card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 12px;
}
.card-t { font-size: 14px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.card-t .sub { font-size: 12px; color: var(--text-2); font-weight: 400; }

/* ============ 统计 ============ */
.stats { display: flex; gap: 10px; margin-bottom: 12px; }
.stat {
  flex: 1; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 10px; text-align: center;
}
.stat .n { font-size: 21px; font-weight: 700; color: var(--main); line-height: 1.3; word-break: break-all; }
.stat .n.red { color: var(--red); }
.stat .l { font-size: 12px; color: var(--text-2); margin-top: 3px; }

.quick { display: flex; gap: 10px; margin-bottom: 12px; }
.quick button {
  flex: 1; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 0; font-size: 14px; font-weight: 600; color: var(--text);
}
.quick button .ic { display: block; font-size: 22px; margin-bottom: 4px; }

/* ============ 列表 ============ */
.row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.row-main { flex: 1; min-width: 0; }
.row-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12px; color: var(--text-2); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-amt { font-size: 16px; font-weight: 700; color: var(--red); white-space: nowrap; }
.row-amt.zero { color: var(--text-3); font-weight: 400; }
.row-amt.green { color: var(--main); }
.row-amt.danger { color: #c2410c; }
.row-amt.severe { color: var(--red); }
.row-act { font-size: 13px; color: var(--main); padding: 4px 6px; white-space: nowrap; }
.row-act.danger { color: var(--red); }
/* 手机号一键拨号 */
a.tel { color: var(--main); text-decoration: none; }

.tag {
  display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px;
  background: var(--main-light); color: var(--main); margin-left: 6px; vertical-align: 1px;
}
.tag.off { background: #f1f2f4; color: var(--text-3); }
.tag.role { background: #eef2ff; color: #4f46e5; }
/* 账龄标签：30 天黄 / 60 天橙 / 90 天红 */
.tag.warn { background: #fff8e6; color: #b45309; }
.tag.danger { background: #fff1e6; color: #c2410c; }
.tag.severe { background: var(--red-light); color: var(--red); }

/* 常用金额一键填 */
.amts { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 12px; }
.amts .amt {
  flex: 1 1 0; min-width: 52px; padding: 8px 0; border: 1px solid var(--line);
  background: #fff; border-radius: 8px; color: var(--main); font-size: 15px;
  font-weight: 600; cursor: pointer;
}
.amts .amt:active { background: var(--main-light); }
.amts .amt.clr { color: var(--text-2); font-weight: 400; flex: 0 0 auto; padding: 8px 10px; }

/* 首页账龄提示条 */
.aging-bar { display: flex; align-items: center; }

.empty { text-align: center; color: var(--text-3); font-size: 13px; padding: 28px 0; }
.loading { text-align: center; color: var(--text-3); font-size: 13px; padding: 32px 0; }

/* ============ 表单 ============ */
.fld { display: block; margin-bottom: 12px; }
.fld > span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 5px; }
.inp {
  width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid #dfe3e8; border-radius: 8px; background: #fff;
  color: var(--text); outline: none;
}
.inp:focus { border-color: var(--main); box-shadow: 0 0 0 3px rgba(31, 122, 90, .1); }
select.inp { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #98a2b3 50%), linear-gradient(135deg, #98a2b3 50%, transparent 50%); background-position: calc(100% - 16px) 20px, calc(100% - 11px) 20px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }

.btn {
  display: inline-block; height: 44px; padding: 0 16px; border-radius: 8px;
  background: #f1f2f4; color: var(--text); font-size: 15px; font-weight: 500;
  border: none; text-align: center;
}
.btn.primary { background: var(--main); color: #fff; }
.btn.primary:active { background: var(--main-dark); }
.btn.danger { background: var(--red-light); color: var(--red); }
.btn.block { display: block; width: 100%; }
.btn.sm { height: 32px; font-size: 13px; padding: 0 10px; border-radius: 6px; }
.btn:disabled { opacity: .5; }

.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.chk { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); }
.chk input { width: 17px; height: 17px; accent-color: var(--main); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters .inp { height: 38px; flex: 1; min-width: 110px; }
.filters .btn { height: 38px; }

/* ============ 会员选择 ============ */
.pick {
  background: var(--main-light); border-radius: 8px; padding: 10px 12px;
  font-size: 14px; margin-bottom: 10px;
}
.pick em { font-style: normal; color: var(--text-2); font-size: 12px; margin-left: 6px; }
.pk-list { max-height: 240px; overflow-y: auto; margin-top: 6px; }
.pk-item { padding: 10px 4px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.pk-item:last-child { border-bottom: none; }
.pk-item .row-main { flex: 1; }

/* ============ Tab ============ */
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.tabs button {
  flex: 1; padding: 10px 0; font-size: 14px; color: var(--text-2);
  border-bottom: 2px solid transparent; font-weight: 500;
}
.tabs button.on { color: var(--main); border-bottom-color: var(--main); font-weight: 600; }

/* ============ 登录 ============ */
.login-wrap { padding: 56px 24px 24px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .ic { font-size: 46px; }
.login-logo h1 { font-size: 20px; margin: 10px 0 4px; font-weight: 700; }
.login-logo p { font-size: 13px; color: var(--text-2); margin: 0; }
.login-box { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 20px 18px; }
.login-box .fld { margin-bottom: 14px; }
.login-foot { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 22px; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .42);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  width: 100%; max-width: 720px; background: #fff;
  border-radius: 14px 14px 0 0; max-height: 88vh; display: flex; flex-direction: column;
  animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-h { padding: 15px 16px 10px; font-size: 16px; font-weight: 600; }
.modal-b { padding: 0 16px 8px; overflow-y: auto; }
.modal-f { display: flex; gap: 10px; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
.modal-f .btn { flex: 1; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 10px);
  z-index: 200; max-width: 82vw;
  background: rgba(35, 39, 46, .92); color: #fff;
  padding: 10px 16px; border-radius: 20px; font-size: 14px;
  opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: rgba(200, 50, 45, .95); }
.toast.ok { background: rgba(31, 122, 90, .95); }

.muted { color: var(--text-3); }
.mt8 { margin-top: 8px; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ===== 会员列表：筛选按钮 + 下拉面板 ===== */
.fbar { margin-top: 8px; }
.fgap { flex: 1; }
.fbtn { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; max-width: 100%; }
.fbtn.on { color: var(--main); border-color: var(--main); background: var(--main-light); }
.fbtn .caret { font-size: 10px; color: var(--text-3); }
.fbtn.on .caret { color: var(--main); }

.pop-mask { position: fixed; inset: 0; z-index: 200; background: transparent; }
.pop {
  position: fixed; z-index: 201; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 6px; box-shadow: 0 10px 28px rgba(16, 24, 40, .16);
}
.pop-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px; border-radius: 8px; cursor: pointer;
}
.pop-item:active { background: var(--bg); }
.pop-item.on { background: var(--main-light); }
.pop-name { font-size: 14px; color: var(--text); }
.pop-item.on .pop-name { color: var(--main); font-weight: 600; }
.pop-desc { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.pop-item .chk { color: var(--main); font-weight: 700; }

/* ===== 首页速记框 ===== */
.quickbox { padding: 14px 14px 12px; }
.qb-row { display: flex; gap: 8px; align-items: stretch; }
.qb-row .inp {
  flex: 1; min-width: 0; height: 56px; font-size: 17px; font-weight: 600;
  border-radius: 12px; border-width: 2px; padding: 0 14px;
}
.qb-row .btn {
  flex: 0 0 auto; min-width: 68px; height: 56px; font-size: 17px; font-weight: 700;
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
}
.qb-hint { margin-top: 10px; }
.qb-hint .qh { display: flex; gap: 8px; font-size: 12px; color: var(--text-2); line-height: 1.7; }
.qb-hint .qh b {
  flex: 0 0 34px; color: var(--main); font-weight: 700;
  background: #eef7f3; border-radius: 5px; text-align: center; height: 18px; line-height: 18px;
  margin-top: 1px; font-size: 11px;
}
.qb-hint .qh span { flex: 1; min-width: 0; }
.qb-hint.qb-done { color: var(--main); font-size: 12px; line-height: 1.6; }

/* v1.8 最近流水卡：赊出红 / 收回绿 */
.row-amt.repay { color: #1a9e5c; font-weight: 700; }
.tag.credit { background: #fdecec; color: var(--red); }
.tag.repay { background: #e8f7ef; color: #1a9e5c; }

/* ============ 首页 v1.9 版面 ============ */
.statbar {
  display: flex; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 11px 0; margin-bottom: 12px;
}
.statbar .sb { flex: 1; text-align: center; line-height: 1.35; min-width: 0; padding: 0 2px; }
.statbar .sb + .sb { border-left: 1px solid var(--line); }
.statbar .sb b { display: block; font-size: 16px; font-weight: 700; word-break: break-all; }
.statbar .sb span { font-size: 11px; color: var(--text-2); }
.statbar .red { color: var(--red); }
