/* 报销台账 · 移动端优先样式 */
:root {
  --accent: #0e7c66;
  --accent-2: #0b5f4e;
  --accent-soft: #e6f3ef;
  --bg: #f4f6f8;
  --card: #ffffff;
  --line: #e6e9ee;
  --ink: #1f2430;
  --ink-2: #6b7280;
  --ink-3: #9aa1ac;
  --ok: #1b7d46;      --ok-bg: #e8f5e9;
  --warn: #b45309;    --warn-bg: #fdf3e2;
  --bad: #c0392b;     --bad-bg: #fdecec;
  --dead: #6b7280;    --dead-bg: #f1f2f4;
  --none: #5b6472;    --none-bg: #eef1f4;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 20px rgba(16,24,40,.06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; }
a { color: var(--accent); }
.loading { text-align: center; color: var(--ink-3); padding: 80px 0; }

/* ---------- 顶栏 ---------- */
.hd {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 8px;
  background: rgba(244,246,248,.88);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.hd-title { font-size: 17px; font-weight: 600; flex: 1; text-align: center; }
.hd-side { width: 64px; display: flex; }
.hd-side.right { justify-content: flex-end; }
.icon-btn {
  width: 40px; height: 40px; border: 0; background: none; color: var(--ink-2);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  border-radius: 10px;
}
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn:active { background: var(--none-bg); }
.hd .link-btn { border: 0; background: none; color: var(--accent); font-size: 14px; cursor: pointer; }

.page { padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }

/* ---------- 首页英雄卡 ---------- */
.hero {
  margin-top: 8px; padding: 20px; border-radius: 18px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px rgba(14,124,102,.28);
}
.hero .h-label { font-size: 12px; opacity: .85; letter-spacing: .5px; }
.hero .h-dir { font-size: 15px; font-weight: 600; margin-top: 10px; }
.hero .h-net { font-size: 32px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.hero .h-even { font-size: 24px; font-weight: 700; margin-top: 10px; }
.h-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.h-chip {
  background: rgba(255,255,255,.16); border-radius: 999px;
  padding: 5px 11px; font-size: 12px; font-variant-numeric: tabular-nums;
}
.h-chip.bad { background: rgba(255,235,232,.28); }
.ov-banner {
  background: var(--bad-bg); color: var(--bad); border-radius: 12px;
  padding: 10px 14px; font-size: 13px; font-weight: 600; margin-top: 12px;
}
.ov-banner a { color: inherit; }

/* ---------- 按钮 ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; height: 48px; border: 0; border-radius: 12px;
  font-size: 16px; font-weight: 600; cursor: pointer;
  transition: transform .06s ease, filter .15s ease;
  font-family: inherit;
}
.btn:active { transform: scale(.985); filter: brightness(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: #eef1f4; color: var(--ink); }
.btn-danger { background: var(--bad-bg); color: var(--bad); }
.btn-sm { width: auto; height: 36px; font-size: 13px; border-radius: 10px; padding: 0 14px; }
.btn svg { width: 18px; height: 18px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.field .req { color: var(--bad); }
input, select, textarea {
  width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 10px;
  background: #fafbfc; padding: 0 12px; font-size: 16px; color: var(--ink);
  font-family: inherit; -webkit-appearance: none; appearance: none;
}
textarea { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,124,102,.14); background: #fff;
}
select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239aa1ac' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.amt-wrap { position: relative; }
.amt-wrap .yen {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--ink-2); font-size: 16px; pointer-events: none;
}
.amt-wrap input { padding-left: 30px; font-weight: 600; }
.seg { display: flex; background: #eef1f4; border-radius: 10px; padding: 3px; gap: 3px; }
.seg button {
  flex: 1; height: 40px; border: 0; border-radius: 8px; background: transparent;
  font-size: 15px; color: var(--ink-2); cursor: pointer; font-family: inherit;
}
.seg button.on { background: #fff; color: var(--accent); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* 状态选择 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.schip {
  padding: 8px 13px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; font-size: 13px; color: var(--ink-2); cursor: pointer; font-family: inherit;
}
.schip.on { font-weight: 600; border-width: 2.5px; padding: 7px 12px; }
.schip.on.st-ok { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.schip.on.st-sub { border-color: #1d6fd1; color: #1d6fd1; background: #e3eefc; }
.schip.on.st-wait { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.schip.on.st-dead { border-color: var(--dead); color: var(--dead); background: var(--dead-bg); }
.schip.on.st-none { border-color: var(--none); color: var(--none); background: var(--none-bg); }

/* ---------- 徽标 ---------- */
.chip {
  display: inline-flex; align-items: center; padding: 3px 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.st-ok { color: var(--ok); background: var(--ok-bg); }
.st-wait { color: var(--warn); background: var(--warn-bg); }
.st-sub { color: #1d6fd1; background: #e3eefc; }
.st-dead { color: var(--dead); background: var(--dead-bg); }
.st-none { color: var(--none); background: var(--none-bg); }
/* 人名：本人绿底白字，对方黑色加粗 */
.name-me {
  background: var(--accent); color: #fff; border-radius: 5px;
  padding: 1px 6px; font-weight: 600; white-space: nowrap;
}
.rec-l2 b, .meta b, .brk-row b { color: var(--ink); font-weight: 600; }
.tag-overdue {
  font-size: 11.5px; color: var(--bad); background: var(--bad-bg);
  padding: 2px 8px; border-radius: 999px; font-weight: 600; white-space: nowrap;
}

/* ---------- 记录卡片 ---------- */
.sec { display: flex; justify-content: space-between; align-items: center; margin: 20px 2px 10px; }
.sec h3 { font-size: 14px; color: var(--ink-2); font-weight: 600; }
.sec a { font-size: 13px; text-decoration: none; }
.rec {
  display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit;
  background: var(--card); border-radius: var(--radius); padding: 13px 15px;
  margin-bottom: 10px; box-shadow: var(--shadow); cursor: pointer;
}
.rec:active { filter: brightness(.985); }
.rec-main { flex: 1; min-width: 0; }
.rec-l1 {
  font-size: 15px; font-weight: 600; display: flex; gap: 6px;
  align-items: center; flex-wrap: wrap;
}
.rec-l2 { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.rec-side { text-align: right; flex: none; }
.rec-amt { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rec-side .chip { margin-top: 5px; }
.empty { text-align: center; color: var(--ink-3); font-size: 14px; padding: 36px 0; }

/* ---------- 筛选 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.filters select, .filters input {
  height: 38px; font-size: 13px; border-radius: 9px; padding: 0 8px;
  width: auto; flex: 1 1 90px; min-width: 0; background: #fff;
}
.filters input { flex: 2 1 130px; padding: 0 10px; }
.filters select { padding-right: 26px; background-position: right 8px center; }
.count-line { font-size: 12.5px; color: var(--ink-3); margin: 8px 2px; font-variant-numeric: tabular-nums; }

/* ---------- 卡片与明细页 ---------- */
.card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); margin-top: 14px;
}
.card h4 { font-size: 14px; color: var(--ink-2); font-weight: 600; margin-bottom: 12px; }
.meta { font-size: 12.5px; color: var(--ink-2); line-height: 2; font-variant-numeric: tabular-nums; }
.hist { border-left: 2px solid var(--line); margin: 8px 0 0 6px; padding-left: 14px; }
.hist div { position: relative; font-size: 12.5px; color: var(--ink-2); padding: 4px 0; }
.hist div::before {
  content: ""; position: absolute; left: -19.5px; top: 11px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}
.detail-head { margin-top: 6px; }
.detail-head .d-amt { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.detail-head .d-l1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- 结算页 ---------- */
.brk { margin-top: 4px; }
.brk-row {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 13.5px; color: var(--ink-2); padding: 7px 0;
  border-bottom: 1px dashed var(--line); font-variant-numeric: tabular-nums;
}
.brk-row:last-child { border-bottom: 0; }
.brk-row .v { color: var(--ink); font-weight: 600; white-space: nowrap; }
.brk-total {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1.5px solid var(--line); margin-top: 6px; padding-top: 12px;
}
.brk-total .t-l { font-size: 14px; font-weight: 600; }
.brk-total .t-v { font-size: 20px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.formula { font-size: 11.5px; color: var(--ink-3); margin-top: 10px; line-height: 1.7; }

/* ---------- 统计 ---------- */
.kgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.kpi { background: var(--card); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.kpi .k-label { font-size: 12px; color: var(--ink-2); }
.kpi .k-val { font-size: 20px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.bar-row {
  display: grid; grid-template-columns: 78px 1fr auto; gap: 10px;
  align-items: center; margin-bottom: 10px; font-size: 13px;
}
.bar-track { height: 10px; border-radius: 5px; background: #eef1f4; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; background: var(--accent); }
.bar-fill.ok { background: var(--ok); }
.bar-row .b-val { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mchart { display: flex; gap: 5px; align-items: flex-end; margin-top: 14px; }
.mcol { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.mbars { display: flex; gap: 2px; align-items: flex-end; height: 80px; }
.mbar { width: 8px; border-radius: 3px 3px 0 0; background: var(--accent); min-height: 2px; }
.mbar.recv { background: var(--ok); }
.mlab { font-size: 10px; color: var(--ink-3); }
.legend { display: flex; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }

/* ---------- 菜单（更多/设置） ---------- */
.menu {
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  overflow: hidden; margin-top: 14px;
}
.menu a, .menu button.mitem {
  display: flex; width: 100%; align-items: center; gap: 12px;
  padding: 15px 16px; background: none; border: 0; border-bottom: 1px solid var(--line);
  font-size: 15px; color: var(--ink); text-decoration: none; cursor: pointer;
  font-family: inherit; text-align: left;
}
.menu a:last-child, .menu button.mitem:last-child { border-bottom: 0; }
.menu .mi { width: 20px; height: 20px; color: var(--accent); flex: none; display: flex; }
.menu .mi svg { width: 20px; height: 20px; }
.menu .chev { margin-left: auto; color: var(--ink-3); font-size: 13px; }
.menu .danger { color: var(--bad); }
.menu .danger .mi { color: var(--bad); }
.srow { display: flex; gap: 8px; margin-bottom: 8px; }
.srow input { flex: 1; min-width: 0; }
.srow .del {
  width: 44px; flex: none; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--bad); font-size: 14px; cursor: pointer; font-family: inherit;
}
.hint { font-size: 12px; color: var(--ink-3); line-height: 1.7; margin-top: 8px; }

/* ---------- 导航（移动端底部 tab，桌面端顶部导航） ---------- */
.topnav { display: none; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: center;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .inner { display: flex; width: 100%; max-width: 560px; }
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 7px; text-decoration: none; color: var(--ink-3); font-size: 10.5px;
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.on { color: var(--accent); font-weight: 600; }

/* ---------- 登录 ---------- */
.login { max-width: 400px; margin: 0 auto; padding: 8vh 26px 40px; text-align: center; }
.login .logo {
  width: 66px; height: 66px; border-radius: 19px; margin: 0 auto 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700;
  box-shadow: 0 10px 26px rgba(14,124,102,.3);
}
.login h1 { font-size: 21px; }
.login .form { margin-top: 30px; text-align: left; }
.user-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.user-pick button {
  height: 52px; border-radius: 12px; border: 1.5px solid var(--line);
  background: #fff; font-size: 16px; color: var(--ink); cursor: pointer; font-family: inherit;
}
.user-pick button.on {
  border-color: var(--accent); color: var(--accent);
  font-weight: 600; background: var(--accent-soft);
}
.lg-err { color: var(--bad); font-size: 13px; min-height: 20px; margin-top: 12px; text-align: center; }

/* ---------- 弹层与提示 ---------- */
.ovl {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.sheet {
  background: #fff; border-radius: 16px; padding: 22px;
  max-width: 340px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.sheet h4 { font-size: 16px; margin-bottom: 8px; }
.sheet p { font-size: 14px; color: var(--ink-2); line-height: 1.65; }
.sheet .row { display: flex; gap: 10px; margin-top: 18px; }
#toast-root {
  position: fixed; top: calc(env(safe-area-inset-top) + 12px); left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; z-index: 200; pointer-events: none;
}
.toast {
  background: rgba(28,32,38,.92); color: #fff; font-size: 14px;
  padding: 10px 18px; border-radius: 999px; margin-top: 8px; max-width: 86%;
  animation: tin .25s ease;
}
.toast.bad { background: rgba(160,40,30,.95); }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- 记录卡：改状态按钮 / 小红点 ---------- */
.rec { cursor: pointer; }
.rec-l2 b { color: var(--ink); font-weight: 600; }
.side-row { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 5px; }
.side-row .chip { flex: none; }
.st-quick {
  flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px;
  font-size: 11px; padding: 2px 9px; color: var(--accent); cursor: pointer; font-family: inherit;
  white-space: nowrap;
}
.st-quick:active { background: var(--accent-soft); }
.dot-badge { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); flex: none; }
.tabbar a { position: relative; }
.tabbar .dot-badge { position: absolute; top: 7px; left: 50%; margin-left: 5px; }
.topnav .dot-badge { display: inline-block; margin-left: 6px; vertical-align: middle; }

/* ---------- 帮助 ---------- */
.help h3 { font-size: 15px; margin: 20px 0 8px; }
.help p, .help li { font-size: 14px; color: var(--ink-2); line-height: 1.8; }
.help ul { padding-left: 18px; }

/* ---------- 桌面端（≥900px）：顶部导航 + 多栏布局 ---------- */
@media (min-width: 900px) {
  body { background: #eceff3; padding-top: 54px; }
  #app { max-width: 1000px; background: var(--bg); box-shadow: 0 0 40px rgba(16,24,40,.06); }
  .hd { top: 54px; }
  .tabbar { display: none; }
  .topnav {
    display: flex; position: fixed; top: 0; left: 0; right: 0; z-index: 60;
    justify-content: center; height: 54px;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
  }
  .topnav .inner {
    display: flex; align-items: center; gap: 6px;
    width: 100%; max-width: 1000px; padding: 0 12px;
  }
  .topnav a {
    display: flex; align-items: center; gap: 7px; padding: 8px 16px;
    border-radius: 10px; text-decoration: none; color: var(--ink-2); font-size: 14px;
  }
  .topnav a svg { width: 18px; height: 18px; }
  .topnav a.on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

  .page { padding-left: 24px; padding-right: 24px; }
  .home-grid { display: grid; grid-template-columns: 5fr 7fr; gap: 26px; align-items: start; }
  .settle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
  .stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
  .settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
  .home-grid .card, .settle-grid .card, .stats-grid .card, .settings-grid .card { margin-top: 0; }
  .home-grid .sec { margin-top: 4px; }
  .kgrid { grid-template-columns: repeat(3, 1fr); }
  .rec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .rec-grid .rec { margin-bottom: 0; }
  .narrow { max-width: 620px; margin: 0 auto; }
  .f2 { gap: 14px; }
}
