/* ============================================================
   合伙分成记账 · 极简移动版
   ============================================================ */

:root {
  --ink: #111214;
  --ink-2: #6b7280;
  --ink-3: #a1a6ae;
  --line: #eceef1;
  --line-2: #f5f6f8;
  --paper: #ffffff;
  --backdrop: #f2f3f5;
  --bad: #d92d20;
  --good: #0f9d76;
  --tab-h: 56px;
  --pad: 22px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--backdrop);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Segoe UI", "Noto Sans SC", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ------------------------------ 外壳 ------------------------------ */

.app {
  position: relative;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 20px);
}

@media (min-width: 520px) {
  .app { box-shadow: 0 0 0 1px rgba(17, 18, 20, 0.06); }
}

/* ------------------------------ 余额 ------------------------------ */

.bal { padding: 30px var(--pad) 6px; }
.bal .label {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.bal .big {
  display: block;
  margin-top: 6px;
  font-size: 44px;
  line-height: 1.08;
  font-weight: 500;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.bal .big.neg { color: var(--bad); }
.bal .hint {
  display: block;
  margin-top: 9px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.bal .hint b { color: var(--ink-2); font-weight: 500; }

/* ------------------------------ 分区标题 ------------------------------ */

.sec {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 26px var(--pad) 6px;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
}
.sec .more {
  margin-left: auto;
  font-size: 12px;
  letter-spacing: 0;
  color: var(--ink-3);
}
button.more { padding: 0; }

/* ------------------------------ 三个人 ------------------------------ */

.people { list-style: none; margin: 0; padding: 0 var(--pad); }
.people li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.people li:first-child { border-top: 0; }
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c);
  flex: none;
}
.people .name { font-size: 15px; }
.people .share { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.people .amt {
  margin-left: auto;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.people .amt.neg { color: var(--bad); }

/* ------------------------------ 流水 ------------------------------ */

.flow { list-style: none; margin: 0; padding: 0; }
.flow li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 13px var(--pad);
  border-top: 1px solid var(--line);
}
.flow .l { flex: 1; min-width: 0; }
.flow .t {
  font-size: 14.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow .s {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow .a {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.flow .a.in { color: var(--good); }
.flow .a.out { color: var(--bad); }

.empty { padding: 42px var(--pad) 26px; text-align: center; color: var(--ink-3); font-size: 13.5px; }
.empty p { margin: 0 0 18px; }
.empty .btns { display: flex; gap: 10px; justify-content: center; }
.empty .btns button {
  padding: 9px 18px;
  border-radius: 11px;
  border: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink);
}
.empty .btns button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.empty .btns button:active { opacity: 0.75; }

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

.types {
  display: flex;
  padding: 4px 12px 0;
  border-bottom: 1px solid var(--line);
}
.types button {
  flex: 1;
  position: relative;
  padding: 13px 2px 12px;
  font-size: 13.5px;
  color: var(--ink-3);
  white-space: nowrap;
}
.types button.on { color: var(--ink); font-weight: 500; }
.types button.on::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
}

.fr {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 12px var(--pad);
  border-top: 1px solid var(--line);
  transition: background 0.12s;
}
.fr:first-child { border-top: 0; }
.fr:focus-within { background: #fafbfc; }
.fr .k {
  flex: none;
  min-width: 58px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.fr .k em {
  font-style: normal;
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.fr .v {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 0;
  background: none;
  font-size: 16px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  appearance: none;
}
.fr .v:focus { outline: none; }
.fr .v::placeholder { color: #c9cdd4; }
.fr.big .v {
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -0.025em;
}
.fr.big .v::placeholder { font-size: 22px; font-weight: 400; }
.fr .v.text { font-size: 15px; }
.fr .v.date { font-size: 14px; max-width: 150px; }

/* 分段选择 */
.seg {
  margin-left: auto;
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: #f2f3f5;
  flex: none;
}
.seg button {
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
}
.seg button.on {
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(17, 18, 20, 0.1);
}

/* 快捷分配 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px var(--pad) 12px; }
.chips button {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.chips button:active { background: var(--line-2); }

.live {
  margin: 0;
  padding: 12px var(--pad) 2px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-3);
}
.live b { color: var(--ink-2); font-weight: 500; }
.live .w { color: var(--bad); }

.submit {
  display: block;
  width: calc(100% - var(--pad) * 2);
  margin: 18px var(--pad) 6px;
  height: 50px;
  border-radius: 13px;
  background: var(--ink);
  color: #fff;
  font-size: 15.5px;
  font-weight: 500;
  transition: opacity 0.15s, transform 0.1s;
}
.submit:active { transform: scale(0.99); }
.submit:disabled { opacity: 0.45; }

/* 设置 */
.prow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px var(--pad);
  border-top: 1px solid var(--line);
}
.prow:first-child { border-top: 0; }.prow .name {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font-size: 15px;
}
.prow .name:focus { outline: none; }
.prow .pct {
  width: 52px;
  border: 0;
  background: none;
  font-size: 15px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.prow .pct:focus { outline: none; }
.prow .unit { font-size: 13px; color: var(--ink-3); }

.link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 15px var(--pad);
  border-top: 1px solid var(--line);
  font-size: 14.5px;
  color: var(--ink);
  text-align: left;
}
.link .arrow { margin-left: auto; color: #ced2d9; font-size: 16px; }
.link.danger { color: var(--bad); }

.url {
  display: block;
  padding: 10px var(--pad) 2px;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.note {
  margin: 0;
  padding: 14px var(--pad) 0;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--ink-3);
}

/* ------------------------------ 底部导航 ------------------------------ */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.tabbar .inner {
  display: flex;
  width: 100%;
  max-width: 480px;
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0 9px;
  font-size: 10.5px;
  color: var(--ink-3);
  transition: color 0.15s;
}
.tabbar button.on { color: var(--ink); }
.tabbar svg { width: 21px; height: 21px; }

/* ------------------------------ Toast ------------------------------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 16px);
  transform: translate(-50%, 10px);
  max-width: 78vw;
  padding: 10px 18px;
  border-radius: 11px;
  background: #111214;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------ 细节 ------------------------------ */

@media (max-width: 360px) {
  :root { --pad: 16px; }
  .bal .big { font-size: 38px; }
  .types button { font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
