/* ---------------------------------------------------------------
   共同账本 — 移动优先样式（无框架、无构建）
   --------------------------------------------------------------- */

:root {
  --bg: #e9ecf2;
  --surface: #ffffff;
  --surface-2: #f5f6fa;
  --surface-3: #eef0f6;
  --line: #e5e8f0;
  --text: #14171f;
  --text-2: #4b5262;
  --muted: #8b92a3;
  --accent: #3a63f0;
  --accent-2: #5b7cff;
  --accent-soft: #ecf1ff;
  --ok: #0ca678;
  --ok-soft: #e2f7f0;
  --warn: #d98410;
  --warn-soft: #fff4e3;
  --danger: #e03131;
  --danger-soft: #ffeeee;
  --radius: 16px;
  --radius-lg: 20px;
  --shadow-1: 0 1px 2px rgba(18, 25, 40, 0.05);
  --shadow-2: 0 10px 30px rgba(18, 25, 40, 0.07);
  --shadow-float: 0 10px 24px rgba(58, 99, 240, 0.32);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d12;
    --surface: #161a23;
    --surface-2: #1d222d;
    --surface-3: #232936;
    --line: #2a3140;
    --text: #f2f4f8;
    --text-2: #c2c8d6;
    --muted: #8a93a6;
    --accent: #6b8bff;
    --accent-2: #8aa2ff;
    --accent-soft: #1b2440;
    --ok: #2ecf9a;
    --ok-soft: #102c25;
    --warn: #f0a63a;
    --warn-soft: #33260f;
    --danger: #ff6b6b;
    --danger-soft: #351a1a;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.45);
    --shadow-float: 0 10px 24px rgba(0, 0, 0, 0.5);
  }
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

input,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

h1,
h2,
h3,
p,
ol,
ul {
  margin: 0;
}

.hidden {
  display: none !important;
}

.mono {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.center {
  text-align: center;
}

/* ------------------------------------------------------------- 手机外壳 */

.phone {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(18, 25, 40, 0.12);
}

@media (min-width: 520px) {
  body {
    padding: 0;
  }
  .phone {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

.view {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* ---------------------------------------------------------------- 登录 */

#login-view {
  overflow-y: auto;
  background:
    radial-gradient(120% 60% at 50% 0%, var(--accent-soft) 0%, transparent 60%),
    var(--surface);
}

.login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 32px 24px calc(32px + env(safe-area-inset-bottom));
  text-align: center;
  gap: 6px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  color: #fff;
  font-size: 30px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-float);
  margin-bottom: 4px;
}

.login-brand h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.login-sub {
  color: var(--muted);
  font-size: 13px;
}

.login-hint {
  margin-top: 28px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
}

.login-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin-top: 14px;
}

.login-member {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.login-member:active {
  transform: scale(0.97);
  box-shadow: none;
}

.login-name {
  font-size: 14px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-foot {
  margin-top: 26px;
  font-size: 12px;
  color: var(--muted);
  max-width: 280px;
}

/* ---------------------------------------------------------------- 头像 */

.avatar {
  --c: var(--accent);
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  user-select: none;
}

.avatar-xs {
  width: 22px;
  height: 22px;
  font-size: 11px;
}

.avatar-sm {
  width: 34px;
  height: 34px;
  font-size: 14px;
}

.avatar-md {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 24px;
}

/* ---------------------------------------------------------------- 框架 */

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
  background: var(--surface);
  border-bottom: 1px solid transparent;
}

.topbar-text {
  min-width: 0;
}

.topbar-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-sub {
  font-size: 12px;
  color: var(--muted);
}

.avatar-btn {
  border-radius: 50%;
  padding: 3px;
  background: var(--surface-2);
}

#app-header,
#app-tabs {
  flex: 0 0 auto;
}

.screen {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px calc(104px + env(safe-area-inset-bottom));
}

.screen-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fade-in 0.18s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
  z-index: 4;
}

.tab {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 0 8px;
  font-size: 11px;
  color: var(--muted);
  transition: color 0.15s;
}

.tab svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab.is-active {
  color: var(--accent);
  font-weight: 600;
}

.badge {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(6px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.fab {
  position: absolute;
  right: 18px;
  bottom: calc(74px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-float);
  z-index: 5;
  transition: transform 0.15s ease;
}

.fab:active {
  transform: scale(0.92);
}

.fab svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

/* -------------------------------------------------------------- 概览卡 */

.summary {
  border-radius: var(--radius-lg);
  padding: 16px 18px 14px;
  background:
    radial-gradient(140% 120% at 100% 0%, rgba(255, 255, 255, 0.22) 0%, transparent 55%),
    linear-gradient(160deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 8px 24px rgba(58, 99, 240, 0.28);
}

.summary-top {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-label {
  font-size: 12px;
  opacity: 0.82;
}

.summary-amount {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.summary-grid div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.summary-grid b {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-grid span {
  font-size: 10.5px;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------ 等你确认 */

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.section-head h2 {
  font-size: 15px;
  font-weight: 700;
}

.count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.section-hint {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.needs {
  border-radius: var(--radius-lg);
  padding: 12px;
  background: var(--warn-soft);
  border: 1px solid rgba(217, 132, 16, 0.18);
}

.need {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-top: 8px;
  box-shadow: var(--shadow-1);
}

.need-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.need-emoji {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.need-text {
  min-width: 0;
  flex: 1;
}

.need-title {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.need-meta {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.need-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.need-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.need-actions .btn {
  flex: 1;
}

/* ---------------------------------------------------------------- 筛选 */

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.filter {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: 0.15s;
}

.filter.is-active {
  background: var(--text);
  color: var(--surface);
  font-weight: 600;
}

.filter i {
  font-style: normal;
  opacity: 0.6;
  font-size: 12px;
}

/* ---------------------------------------------------------------- 列表 */

.day-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.day-head {
  display: flex;
  justify-content: space-between;
  padding: 6px 4px 2px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  transition: background 0.12s ease;
  cursor: pointer;
}

.row:active {
  background: var(--surface-2);
}

.row-emoji {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  font-size: 19px;
}

.row-body {
  flex: 1;
  min-width: 0;
}

.row-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: 0 0 auto;
}

.row-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
}

.pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.pill-wait {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.pill-bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 8px;
  opacity: 0.9;
}

.empty-sub {
  font-size: 12px;
  margin-top: 4px;
}

.foot-note {
  font-size: 11.5px;
  color: var(--muted);
  padding: 4px 6px 8px;
  line-height: 1.6;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-1);
}

.balance-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.balance-row:first-of-type {
  border-top: none;
}

.balance-text {
  flex: 1;
  min-width: 0;
}

.balance-name {
  font-size: 14px;
  font-weight: 600;
}

.balance-sub {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.net {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.net-plus {
  color: var(--ok);
}

.net-minus {
  color: var(--danger);
}

.net-zero {
  color: var(--muted);
  font-weight: 500;
}

.tag-me {
  font-style: normal;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: 1px;
}

.transfer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.transfer:first-of-type {
  border-top: none;
}

.transfer-from,
.transfer-to {
  font-weight: 600;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transfer-arrow {
  color: var(--muted);
}

.transfer-amount {
  margin-left: auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ok);
}

/* ---------------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}

.btn:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.btn:disabled {
  opacity: 0.5;
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 6px 16px rgba(58, 99, 240, 0.28);
}

.btn-ok {
  background: var(--ok);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-ghost {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}

.btn-bad-ghost {
  background: transparent;
  border-color: rgba(224, 49, 49, 0.35);
  color: var(--danger);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  height: 50px;
  font-size: 15.5px;
  border-radius: 14px;
}

.btn-sm {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 10px;
}

.btn-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

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

.action-row .btn {
  flex: 1;
}

/* ---------------------------------------------------------------- 我的 */

.identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.identity-text {
  flex: 1;
  min-width: 0;
}

.identity-name {
  font-size: 17px;
  font-weight: 700;
}

.identity-sub {
  font-size: 12px;
  color: var(--muted);
}

.field-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0 6px;
}

.field-label:first-child {
  margin-top: 0;
}

.text-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

textarea.text-input {
  height: auto;
  padding: 10px 12px;
  resize: none;
  line-height: 1.5;
}

.text-input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.member-row .text-input {
  flex: 1;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.inline-form .text-input {
  width: 110px;
  text-align: center;
}

.rules {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}

.rules b {
  color: var(--text);
}

/* ---------------------------------------------------------------- 弹层 */

.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-root[hidden] {
  display: none;
}

.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 11, 18, 0.45);
  backdrop-filter: blur(2px);
  animation: fade-in 0.18s ease;
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 0 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(8, 11, 18, 0.24);
  animation: sheet-up 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  overscroll-behavior: contain;
}

@keyframes sheet-up {
  from {
    transform: translateY(18%);
    opacity: 0.6;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.sheet-grab {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 8px auto 0;
}

.sheet-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 8px;
  background: var(--surface);
  font-size: 15px;
  font-weight: 700;
}

.sheet-head button {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.sheet-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}

/* ---------------------------------------------------------------- 记一笔 */

.amount-field {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 2px 10px;
  border-bottom: 1px solid var(--line);
}

.amount-field .currency {
  font-size: 24px;
  font-weight: 600;
  color: var(--muted);
}

.amount-field input {
  flex: 1;
  border: none;
  outline: none;
  background: none;
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  min-width: 0;
  padding: 0;
}

.amount-field input::placeholder {
  color: var(--line);
}

.cat-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.cat-row::-webkit-scrollbar {
  display: none;
}

.cat {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 54px;
  padding: 7px 0 5px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid transparent;
  font-size: 11px;
  color: var(--text-2);
  transition: 0.15s;
}

.cat span {
  font-size: 18px;
  line-height: 1.2;
}

.cat.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.field {
  display: flex;
  flex-direction: column;
}

.field-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px 0 7px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-2);
  transition: 0.15s;
}

.chip.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.preview {
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  text-align: center;
}

.preview b {
  color: var(--accent);
  font-size: 15px;
}

/* ---------------------------------------------------------------- 详情 */

.detail-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 0 4px;
  text-align: center;
}

.detail-cat {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  font-size: 26px;
  margin-bottom: 2px;
}

.detail-amount {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

.detail-title {
  font-size: 15px;
  font-weight: 600;
}

.detail-meta {
  font-size: 12px;
  color: var(--muted);
}

.detail-pill {
  margin-top: 6px;
}

.note {
  background: var(--surface-2);
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-2);
}

.block {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.block-head {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.kv-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 13.5px;
}

.kv-row b {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.approve-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  font-size: 13.5px;
  color: var(--text-2);
}

.approve-name {
  flex: 1;
}

.approve-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.approve-state i {
  font-style: normal;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  font-size: 11px;
}

.approve-row.is-ok .approve-state {
  color: var(--ok);
}

.approve-row.is-ok .approve-state i {
  background: var(--ok-soft);
}

.approve-row.is-bad .approve-state {
  color: var(--danger);
}

.approve-row.is-bad .approve-state i {
  background: var(--danger-soft);
}

.lock-note {
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  text-align: center;
}

.veto-title {
  font-size: 17px;
  font-weight: 700;
  margin-top: 6px;
}

/* ---------------------------------------------------------------- 密码 */

.pin-sheet {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 0 6px;
}

.pin-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.pin-name {
  font-size: 16px;
  font-weight: 700;
}

.pin-tip {
  font-size: 12px;
  color: var(--muted);
}

.pin-dots {
  display: flex;
  gap: 14px;
  padding: 10px 0 2px;
}

.pin-dots i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--line);
  transition: 0.12s;
}

.pin-dots i.on {
  background: var(--accent);
  transform: scale(1.08);
}

.pin-error {
  height: 16px;
  font-size: 12px;
  color: var(--danger);
}

.pin-sheet.shake {
  animation: shake 0.32s;
}

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 300px;
}

.key {
  height: 50px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background 0.12s;
}

.key:active {
  background: var(--surface-3);
}

.key-ghost {
  background: none;
  pointer-events: none;
}

/* ---------------------------------------------------------------- 提示 */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  max-width: 320px;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(20, 23, 31, 0.92);
  color: #fff;
  font-size: 13px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 80;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  color: var(--muted);
  font-size: 13px;
}

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 小屏收紧 */
@media (max-width: 360px) {
  .summary-amount {
    font-size: 28px;
  }
  .sheet {
    padding-left: 14px;
    padding-right: 14px;
  }
  .cat {
    width: 50px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
