/* ========== 基础 ========== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: #e9edf4;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
:root {
  --bg: #f2f4f8;
  --card: #fff;
  --ink: #23262d;
  --ink-2: #8a93a2;
  --line: #e3e8ef;
  --brand: #3b5bdb;
  --brand-deep: #2f4bc0;
  --brand-soft: #edf1fd;
  --danger: #e03131;
  --ok: #2f9e44;
  --radius: 16px;
  --shadow: 0 2px 14px rgba(25, 39, 80, .08);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration: none; }

#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  box-shadow: 0 0 40px rgba(0,0,0,.06);
  padding-bottom: calc(76px + var(--safe-b));
}

/* ========== 顶部 ========== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(242, 244, 248, .94);
  backdrop-filter: blur(10px);
  padding: calc(10px + var(--safe-t)) 16px 10px;
  border-bottom: 1px solid var(--line);
}
.topbar .row1 { display: flex; align-items: center; gap: 8px; }
.topbar .title { font-size: 20px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .space-name { font-size: 12px; color: var(--ink-2); font-weight: 400; margin-left: 8px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-2); background: var(--card); border: 1px solid var(--line);
}
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.spin svg { animation: rot .8s linear infinite; }
.add-btn {
  flex: none; height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 4px;
  box-shadow: 0 2px 10px rgba(59, 91, 219, .35);
}
.add-btn:active { transform: scale(.95); background: var(--brand-deep); }
.add-btn svg { width: 15px; height: 15px; }

.subheader {
  position: sticky; top: 0; z-index: 20;
  background: rgba(242, 244, 248, .94); backdrop-filter: blur(10px);
  padding: calc(12px + var(--safe-t)) 16px 10px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
}
.subheader .back { margin-left: -6px; }
.subheader .t { font-size: 17px; font-weight: 700; flex: 1; }

/* ========== 筛选条 ========== */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 5px 14px; border-radius: 999px; font-size: 13px;
  background: var(--card); color: var(--ink-2); border: 1px solid var(--line);
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.chip .n { font-size: 11px; opacity: .8; margin-left: 2px; }

/* ========== 总览：预算主卡 + 阶段卡片 ========== */
.budget-hero {
  margin: 14px 16px 0; padding: 16px 18px;
  background: linear-gradient(135deg, #3b5bdb, #4c6ef5);
  border-radius: 20px; color: #fff; box-shadow: 0 6px 20px rgba(59, 91, 219, .3);
  position: relative;
}
.budget-hero .bh-label { font-size: 12px; opacity: .85; }
.budget-hero .bh-main { display: flex; align-items: baseline; gap: 10px; margin-top: 2px; flex-wrap: wrap; }
.budget-hero .bh-budget { font-size: 28px; font-weight: 700; letter-spacing: .5px; }
.budget-hero .bh-edit {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: rgba(255,255,255,.18); color: #fff;
}
.budget-hero .bh-nums { display: flex; gap: 18px; margin-top: 10px; font-size: 13px; flex-wrap: wrap; }
.budget-hero .bh-nums b { font-size: 16px; font-weight: 700; display: block; }
.budget-hero .bh-nums .over b { color: #ffc9c9; }
.budget-hero .bh-bar {
  margin-top: 12px; height: 8px; border-radius: 999px; background: rgba(255,255,255,.25); overflow: hidden;
}
.budget-hero .bh-bar i { display: block; height: 100%; background: #ffd43b; border-radius: 999px; }
.budget-hero .bh-items { margin-top: 8px; font-size: 12px; opacity: .85; }
.budget-hero.bare { text-align: center; padding: 26px 18px; }
.budget-hero .bh-set { margin-top: 12px; height: 40px; padding: 0 22px; border-radius: 12px; background: rgba(255,255,255,.2); color: #fff; font-size: 14px; font-weight: 600; }

.stage-card {
  display: flex; align-items: center; gap: 12px; width: calc(100% - 32px);
  margin: 10px 16px 0; padding: 13px 14px; text-align: left;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
}
.stage-card:active { transform: scale(.985); }
.stage-card .sc-info { flex: 1; min-width: 0; }
.stage-card .sc-name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.stage-card .sc-name .done-n { font-size: 12px; color: var(--ink-2); font-weight: 400; }
.stage-card .sc-bar { margin-top: 7px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.stage-card .sc-bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.stage-card .sc-bar i.full { background: var(--ok); }
.stage-card .sc-sub { margin-top: 5px; font-size: 12px; color: var(--ink-2); display: flex; gap: 8px; flex-wrap: wrap; }
.stage-card .sc-sub .over { color: var(--danger); font-weight: 600; }
.stage-card .sc-edit {
  flex: none; width: 30px; height: 30px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; color: var(--ink-2); background: var(--bg);
}
.stage-card .sc-edit svg { width: 14px; height: 14px; }

/* ========== 进度条通用 ========== */
.bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* ========== 清单页 ========== */
.group-head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 16px 16px 8px; font-size: 13px; font-weight: 700; color: var(--ink-2);
}
.group-head:first-child { padding-top: 8px; }
.group-head .gh-stat { font-weight: 400; font-size: 11px; opacity: .85; }
.group-head .gh-budget { margin-left: auto; font-weight: 400; font-size: 11px; }
.item-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  background: var(--card); border-bottom: 1px solid var(--line); cursor: pointer;
}
.item-row-wrap > .item-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.item-row-wrap > .item-row:last-child { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.item-row-wrap > .item-row:only-child { border-radius: var(--radius); }
.item-row:active { background: var(--brand-soft); }
.item-row .ir-main { flex: 1; min-width: 0; }
.item-row .ir-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row .ir-sub { font-size: 12px; color: var(--ink-2); margin-top: 1px; display: flex; gap: 8px; flex-wrap: wrap; }
.item-row .ir-amt { flex: none; text-align: right; font-size: 13px; color: var(--ink-2); line-height: 1.4; }
.item-row .ir-amt .spent { color: var(--ink); font-weight: 600; }
.item-row .ir-amt .over { color: var(--danger); }
.item-row.is-done .ir-title { color: var(--ink-2); text-decoration: line-through; }
.item-row.is-dropped .ir-title { color: var(--ink-2); text-decoration: line-through; }
/* 一键完成圆钮 */
.ir-check {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #ccd4e0; color: transparent; background: var(--card);
  display: flex; align-items: center; justify-content: center;
}
.ir-check svg { width: 14px; height: 14px; }
.ir-check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.viewer-tip { margin: 14px 16px 0; padding: 10px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-deep); font-size: 13px; text-align: center; }

/* 状态胶囊 */
.st { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; flex: none; }
.st.todo    { background: #eceff4; color: #5c6779; }
.st.chosen  { background: #d0ebff; color: #1971c2; }
.st.bought  { background: #ffe8cc; color: #d9480f; }
.st.done    { background: #d3f9d8; color: #2b8a3e; }
.st.dropped { background: #f1f3f5; color: #adb5bd; text-decoration: line-through; }

/* ========== 记账页 ========== */
.money-sum {
  margin: 14px 16px 0; padding: 14px 16px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
}
.money-sum .ms-row { display: flex; gap: 16px; flex-wrap: wrap; }
.money-sum .ms-cell b { font-size: 18px; font-weight: 700; display: block; color: var(--ink); }
.money-sum .ms-cell .lb { font-size: 12px; color: var(--ink-2); }
.money-sum .ms-paid { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.money-sum .ms-paid .lb2 { font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.money-sum .ms-paid-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 2px 0; }
.money-sum .ms-paid-row .who { color: var(--ink); font-weight: 600; }
.money-sum .ms-paid-row .amt { margin-left: auto; font-weight: 600; }
.ledger-month { padding: 18px 16px 4px; font-size: 14px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; }
.ledger-month .m-sum { font-size: 12px; color: var(--ink-2); font-weight: 400; margin-left: auto; }
.exp-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--card); border-bottom: 1px solid var(--line); cursor: pointer;
}
.exp-row:first-of-type { border-radius: var(--radius) var(--radius) 0 0; }
.exp-row:last-of-type { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.exp-row:only-of-type { border-radius: var(--radius); }
.exp-row:active { background: var(--brand-soft); }
.exp-row .er-date { flex: none; font-size: 12px; color: var(--ink-2); width: 40px; }
.exp-row .er-main { flex: 1; min-width: 0; }
.exp-row .er-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-row .er-sub { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-row .er-amt { flex: none; font-size: 15px; font-weight: 700; }

/* ========== FAB ========== */
.fab {
  position: fixed; right: calc(50% - 320px + 18px); bottom: calc(86px + var(--safe-b));
  height: 48px; padding: 0 18px; border-radius: 16px; background: var(--brand); color: #fff;
  box-shadow: 0 6px 20px rgba(59, 91, 219, .45); z-index: 30;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 14px; font-weight: 600;
}
.fab:active { transform: scale(.93); background: var(--brand-deep); }
.fab svg { width: 20px; height: 20px; }
@media (max-width: 640px) { .fab { right: 18px; } }

/* ========== 底部导航 ========== */
.nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 640px; z-index: 40;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex; padding-bottom: var(--safe-b);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 6px; color: var(--ink-2); font-size: 11px; user-select: none;
}
.nav a svg { width: 24px; height: 24px; }
.nav a.on { color: var(--brand); font-weight: 600; }

/* ========== 表单 ========== */
.field { padding: 14px 16px 0; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number], .field input[type=date], .field input[type=url], .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  padding: 10px 12px; font-size: 15px; outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--brand); }
.field textarea { resize: vertical; min-height: 72px; }
.form-actions { display: flex; gap: 10px; padding: 20px 16px 6px; }
.btn-main {
  flex: 1; height: 46px; border-radius: 14px; background: var(--brand); color: #fff;
  font-size: 16px; font-weight: 600; box-shadow: 0 4px 14px rgba(59, 91, 219, .3);
}
.btn-main:active { background: var(--brand-deep); }
.btn-main[disabled] { opacity: .5; }
.btn-outline { border: 1.5px solid var(--line); background: var(--card); color: var(--ink); }
.btn-danger { border: 1.5px solid #f1b8b8; background: #fff; color: var(--danger); }
.detail-actions { display: flex; gap: 10px; padding: 18px 16px 4px; }
.detail-actions button { flex: 1; height: 44px; border-radius: 14px; font-size: 15px; }

/* ========== 详情弹层（条目/记一笔/预算等） ========== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 28, 50, .45); z-index: 90;
  display: flex; align-items: flex-end; justify-content: center; animation: fade-in .18s ease-out;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 640px; background: var(--bg); border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(18px + var(--safe-b)); max-height: 88vh; overflow-y: auto;
  animation: sheet-up .22s ease-out;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } }
.modal h3 { margin: 0 0 4px; font-size: 17px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.modal h3 .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal h3 .x { color: var(--ink-2); width: 30px; height: 30px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--card); border: 1px solid var(--line); }
.modal h3 .x svg { width: 14px; height: 14px; }
.modal .hint { font-size: 12px; color: var(--ink-2); margin: 0 0 12px; }

/* 条目详情层 */
.sheet-status { display: flex; gap: 6px; padding: 12px 0 2px; }
.sheet-status button {
  flex: 1; height: 34px; border-radius: 10px; font-size: 13px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
}
.sheet-status button.on { font-weight: 700; }
.sheet-status button.on.todo    { background: #eceff4; border-color: #adb5bd; color: #495057; }
.sheet-status button.on.chosen  { background: #d0ebff; border-color: #1971c2; color: #1971c2; }
.sheet-status button.on.bought  { background: #ffe8cc; border-color: #d9480f; color: #d9480f; }
.sheet-status button.on.done    { background: #d3f9d8; border-color: #2b8a3e; color: #2b8a3e; }
.sheet-status button.on.dropped { background: #f1f3f5; border-color: #adb5bd; color: #868e96; }
.kv-sec { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-top: 12px; }
.kv-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv-row:last-child { border-bottom: 0; }
.kv-row .k { flex: none; color: var(--ink-2); font-size: 13px; width: 64px; }
.kv-row .v { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.kv-row .v.num { text-align: right; font-weight: 600; }
.kv-row .v .over { color: var(--danger); font-weight: 700; }
.kv-row .v a { word-break: break-all; }
.notes-box { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; font-size: 14px; white-space: pre-wrap; margin-top: 12px; }
.mini-line-btn {
  margin-top: 10px; width: 100%; height: 40px; border-radius: 12px;
  border: 1.5px dashed var(--brand); color: var(--brand); background: var(--brand-soft);
  font-size: 14px; font-weight: 600;
}
.mini-line-btn:active { opacity: .8; }

/* ========== 设置 ========== */
.settings-group { margin: 16px 16px 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.settings-group h3 { margin: 0; padding: 12px 16px 4px; font-size: 13px; color: var(--ink-2); }
.settings-group h3 .badge { vertical-align: 2px; margin-left: 6px; }
.settings-row { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.settings-row:last-child { border-bottom: 0; }
.settings-row .k { flex: 1; min-width: 0; }
.settings-row .k .sub { font-size: 12px; color: var(--ink-2); }
.settings-row input { border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: 14px; outline: none; width: 180px; max-width: 46vw; text-align: right; }
.settings-row input:focus { border-color: var(--brand); }
.settings-row .code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--brand-deep); background: var(--brand-soft); padding: 4px 8px; border-radius: 8px; word-break: break-all; text-align: right; }
.settings-row .v-readonly { font-size: 14px; color: var(--ink-2); }
.settings-row.link-row { cursor: pointer; }
.settings-row.link-row:active { background: var(--brand-soft); }
.settings-row .chev { color: var(--ink-2); font-size: 20px; padding: 0 2px; }
.small-btn {
  height: 34px; padding: 0 14px; border-radius: 10px; background: var(--brand); color: #fff;
  font-size: 13px; font-weight: 600; flex: none;
}
.small-btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.small-btn.danger { background: #fff; color: var(--danger); border: 1px solid #f1b8b8; }
.settings-foot { text-align: center; color: var(--ink-2); font-size: 12px; padding: 24px 0 12px; }

.badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.badge.admin { background: #fff4d6; color: #9a6700; }
.badge.member { background: #e7f5e7; color: #2b7a3d; }
.badge.viewer { background: #eef0f2; color: #66707a; }

.member-list { padding: 4px 16px; }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.member-row:last-child { border-bottom: 0; }
.member-row .info { display: flex; align-items: center; gap: 8px; min-width: 0; }
.member-row .nm { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-row .ops { display: flex; gap: 6px; flex: none; }

/* 阶段管理行 */
.group-manage-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.group-manage-row:last-child { border-bottom: 0; }
.group-manage-row input.gname { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 15px; font-weight: 600; padding: 4px; }
.group-manage-row input.gbudget { flex: none; width: 86px; border: 1px solid var(--line); border-radius: 9px; padding: 5px 8px; font-size: 13px; outline: none; text-align: right; }
.mini-btn {
  flex: none; width: 30px; height: 30px; border-radius: 10px; color: var(--ink-2);
  display: flex; align-items: center; justify-content: center; background: var(--bg);
}
.mini-btn svg { width: 15px; height: 15px; }
.mini-btn.del { color: #d09292; }
.mini-btn:active { transform: scale(.9); }

/* ========== 回收站 ========== */
.bin-list { padding: 4px 16px 24px; }
.bin-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.bin-row:last-child { border-bottom: 0; }
.bin-row .info { min-width: 0; flex: 1; }
.bin-row .nm { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bin-row .sub { font-size: 12px; color: var(--ink-2); }
.bin-row .ops { display: flex; gap: 6px; flex: none; }

/* ========== 加入/登录页 ========== */
.hero {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 40px 24px calc(40px + var(--safe-b)); text-align: center;
}
.hero .logo { width: 88px; height: 88px; border-radius: 24px; box-shadow: 0 10px 30px rgba(59, 91, 219, .3); }
.hero h1 { margin: 20px 0 6px; font-size: 26px; }
.hero p { margin: 0; color: var(--ink-2); font-size: 14px; }
.hero .panel {
  width: 100%; max-width: 380px; margin-top: 28px; background: var(--card); border-radius: 20px;
  box-shadow: var(--shadow); padding: 20px; text-align: left;
}
.hero .panel h2 { margin: 0 0 4px; font-size: 17px; }
.hero .panel .hint { font-size: 12px; color: var(--ink-2); margin: 0 0 12px; }
.hero .panel .field { padding: 0 0 12px; }
.hero .panel .btn-main { width: 100%; flex: none; margin-top: 4px; }
.hero .switch { margin-top: 14px; font-size: 13px; color: var(--ink-2); }
.hero .switch a { font-weight: 600; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.auth-tab {
  flex: 1; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font-size: 14px; color: var(--ink-2);
}
.auth-tab.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* ---------- 我的空间页 ---------- */
.sp-head { display: flex; align-items: center; gap: 13px; padding: 24px 16px 4px; }
.sp-head img { width: 48px; height: 48px; border-radius: 15px; box-shadow: 0 6px 18px rgba(59, 91, 219, .25); }
.sp-hi { font-size: 20px; font-weight: 700; }
.sp-email { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.sp-sec { font-size: 12px; color: var(--ink-2); font-weight: 600; margin: 22px 16px 10px; }
.space-card {
  display: flex; align-items: center; gap: 12px; width: calc(100% - 32px);
  margin: 0 16px 10px; padding: 13px 14px; text-align: left;
  background: var(--brand-soft); border-radius: 16px;
}
.space-card:active { transform: scale(.98); }
.sp-ico { width: 44px; height: 44px; border-radius: 13px; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 23px; flex: none; box-shadow: var(--shadow); }
.sp-info { flex: 1; min-width: 0; }
.sp-nm { display: block; font-size: 16px; font-weight: 700; }
.sp-sub { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); margin-top: 3px; flex-wrap: wrap; }
.space-card .chev { font-size: 24px; color: var(--brand); flex: none; line-height: 1; }
.sp-empty { margin: 0 16px; padding: 26px 16px; text-align: center; font-size: 13px; color: var(--ink-2); background: var(--card); border-radius: 16px; line-height: 2.1; box-shadow: var(--shadow); }
.sp-form { margin: 10px 16px 0; padding: 4px 16px 16px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); }
.sp-form .field { padding: 12px 0 0; }
.sp-form .btn-main { width: 100%; margin-top: 14px; }
.sp-note { font-size: 12px; color: var(--ink-2); margin: 4px 0 0; }
.sp-add {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: calc(100% - 32px); margin: 0 16px; height: 52px;
  border: 1.5px dashed #b9c4dd; border-radius: 16px; color: var(--ink-2); font-size: 14px; font-weight: 600;
}
.sp-signout { display: block; margin: 32px auto 10px; font-size: 13px; color: var(--ink-2); text-decoration: underline; }

/* ========== 通用 ========== */
.loading { padding: 60px 0; display: flex; justify-content: center; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--brand);
  animation: rot .8s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 60px 24px; color: var(--ink-2); }
.empty .e { font-size: 44px; margin-bottom: 8px; }
.empty .add { margin-top: 16px; display: inline-block; }

.toast {
  position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%);
  background: rgba(35, 38, 45, .92); color: #fff; font-size: 14px;
  padding: 10px 18px; border-radius: 12px; z-index: 100; max-width: 80vw; text-align: center;
  animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* 确认弹窗（居中小框） */
.modal-ov { position: fixed; inset: 0; background: rgba(20,28,50,.45); z-index: 85; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-box { background: #fff; border-radius: 16px; padding: 18px 16px 14px; width: 100%; max-width: 320px; box-shadow: 0 12px 40px rgba(0,0,0,.18); }
.modal-box h3 { margin: 0 0 12px; font-size: 16px; }
.modal-msg { font-size: 15px; line-height: 1.7; white-space: pre-line; padding: 2px 2px 14px; }
.modal-ops { display: flex; gap: 8px; }
.modal-ops .small-btn { flex: 1; height: 40px; }
.modal-code-row { display: flex; gap: 8px; align-items: stretch; margin: -4px 0 12px; }
.modal-code { flex: 1; display: flex; align-items: center; background: var(--brand-soft); border: 1px dashed var(--brand); color: var(--brand-deep); border-radius: 8px; padding: 10px 12px; font-size: 15px; letter-spacing: 1px; word-break: break-all; }
