:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #e6e8eb;
  --text: #16191d;
  --muted: #6b7280;
  --brand: #0f766e;
  --brand-soft: #e6f4f2;
  --pending: #d97706;
  --pending-soft: #fef3e2;
  --submitted: #2563eb;
  --submitted-soft: #e8f0fe;
  --paid: #059669;
  --paid-soft: #e7f6ef;
  --rejected: #6b7280;
  --rejected-soft: #f1f2f4;
  --danger: #dc2626;
  --radius: 14px;
  --nav-h: 56px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

#app { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 76px); }

/* ---------- 通用 ---------- */
.wrap { padding: 14px; max-width: 720px; margin: 0 auto; }
.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; border: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 10px; }
button { font: inherit; cursor: pointer; }

.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 10px; padding: 9px 14px; font-size: 14px;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { background: var(--card); border-color: #f3c9c9; color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }

input, select, textarea {
  font: inherit; width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { resize: vertical; min-height: 64px; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- 顶栏与导航 ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand); color: #fff;
  padding: calc(env(safe-area-inset-top) + 12px) 14px 12px;
}
.top .inner { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.top h1 { color: #fff; font-size: 17px; }

.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav button {
  flex: 1; border: 0; background: none; color: var(--muted);
  padding: 8px 0 7px; font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.nav button .ic { font-size: 19px; line-height: 1; }
.nav button.on { color: var(--brand); font-weight: 600; }

.fab {
  position: fixed; right: 18px; z-index: 31;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--brand); color: #fff; border: 0; font-size: 28px; line-height: 1;
  box-shadow: 0 4px 14px rgba(15, 118, 110, .35);
}

/* ---------- 看板 ---------- */
.hero { background: linear-gradient(135deg, #0f766e, #115e59); color: #fff; border: 0; }
.hero .amt { font-size: 32px; font-weight: 700; letter-spacing: -.5px; }
.hero .lbl { font-size: 13px; opacity: .85; }
.hero .split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.hero .split div { background: rgba(255, 255, 255, .14); border-radius: 10px; padding: 9px 11px; }
.hero .split b { font-size: 17px; display: block; }
.hero .split span { font-size: 12px; opacity: .85; }

.alert { background: var(--pending-soft); border-color: #f6dcb4; }
.alert .row { justify-content: space-between; }

.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.pill.pending { background: var(--pending-soft); color: var(--pending); }
.pill.submitted { background: var(--submitted-soft); color: var(--submitted); }
.pill.paid { background: var(--paid-soft); color: var(--paid); }
.pill.rejected { background: var(--rejected-soft); color: var(--rejected); }

.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 12px; background: var(--brand-soft); color: var(--brand); }

/* ---------- 列表 ---------- */
.chips { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 999px; padding: 6px 13px; font-size: 13px; white-space: nowrap; flex: none;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }

.item { display: flex; align-items: flex-start; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .amt { font-size: 16px; font-weight: 600; white-space: nowrap; }
.item .ttl { font-weight: 500; }
.dot { width: 4px; border-radius: 2px; flex: none; align-self: stretch; min-height: 34px; }

.empty { text-align: center; color: var(--muted); padding: 46px 20px; }
.empty .big { font-size: 38px; display: block; margin-bottom: 8px; opacity: .5; }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .42);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--card); width: 100%; max-width: 720px;
  border-radius: 18px 18px 0 0; padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
  max-height: 92vh; overflow-y: auto; animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
.sheet .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet .head h2 { margin: 0; font-size: 17px; }
.x { border: 0; background: none; font-size: 24px; color: var(--muted); line-height: 1; padding: 2px 6px; }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumb { position: relative; width: 74px; height: 74px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; font-size: 13px; line-height: 1;
}
.thumb.add { display: flex; align-items: center; justify-content: center; background: var(--bg); color: var(--muted); font-size: 24px; }

/* ---------- 登录 ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login .card { width: 100%; max-width: 360px; padding: 24px; }
.login .logo { font-size: 40px; text-align: center; margin-bottom: 6px; }
.login h1 { text-align: center; font-size: 19px; margin-bottom: 4px; }
.login .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 20px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 84px);
  transform: translateX(-50%); z-index: 60;
  background: #16191d; color: #fff; padding: 9px 16px; border-radius: 999px;
  font-size: 13px; max-width: 86vw; text-align: center; animation: up .16s ease-out;
}
.toast.err { background: var(--danger); }

.projhead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; }

@media (min-width: 720px) {
  .grid2 { grid-template-columns: 1fr 1fr; }
  .mask { align-items: center; }
  .sheet { border-radius: 18px; max-height: 86vh; }
}
