:root {
  --bg: #f7f3ff;
  --card: rgba(255, 255, 255, .92);
  --text: #20153d;
  --muted: #796e92;
  --primary: #7c3aed;
  --primary-2: #a855f7;
  --income: #10b981;
  --expense: #f97316;
  --danger: #ef4444;
  --line: #e8defc;
  --shadow: 0 18px 40px rgba(79, 31, 146, .12);
  --radius: 22px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; background: radial-gradient(circle at top left, #fff7ed 0, transparent 28%), radial-gradient(circle at top right, #ede9fe 0, transparent 32%), var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
.app-shell { width: min(100%, 720px); margin: 0 auto; padding: env(safe-area-inset-top) 14px calc(82px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 16px 2px 12px; backdrop-filter: blur(14px); }
.top-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.eyebrow { margin: 0 0 2px; color: var(--primary); font-size: 11px; letter-spacing: 1px; font-weight: 700; }
h1 { margin: 0; font-size: 21px; line-height: 1.2; }
h2, h3, p { margin-top: 0; }
.page { display: none; animation: fade .18s ease-out; }
.page.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hero-card, .panel, .stat-card { background: var(--card); border: 1px solid rgba(255,255,255,.72); border-radius: var(--radius); box-shadow: var(--shadow); }
.brand-image-card { margin: clamp(4px, 1.2vw, 10px) 0 clamp(14px, 2.2vw, 22px); aspect-ratio: 2.7 / 1; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,.74); background: #fff7ed; }
.brand-image-card img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center 46%; }
.hero-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px; background: linear-gradient(135deg, rgba(124,58,237,.95), rgba(168,85,247,.86)); color: #fff; overflow: hidden; position: relative; }
.hero-card::after { content: ""; position: absolute; width: 150px; height: 150px; right: -60px; top: -70px; border-radius: 50%; background: rgba(255,255,255,.16); }
.hero-card h2 { margin: 4px 0 6px; font-size: 30px; }
.hero-card p { margin-bottom: 0; color: rgba(255,255,255,.86); font-size: 13px; }
.muted { color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 14px 0; }
.stat-card { padding: 14px; min-height: 86px; display: flex; flex-direction: column; justify-content: space-between; }
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card strong { font-size: 21px; line-height: 1.1; word-break: break-all; }
.stat-card.income strong { color: var(--income); }
.stat-card.expense strong { color: var(--expense); }
.stat-card.balance strong { color: var(--primary); }
.stat-card.rate strong { color: #0ea5e9; }
.panel { padding: 16px; margin: 14px 0; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-title h3 { margin: 0; font-size: 17px; }
.primary, .secondary, .ghost, .icon-btn, .file-btn { border-radius: 14px; padding: 11px 14px; font-weight: 700; }
.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 12px 20px rgba(124,58,237,.2); }
.secondary { background: #f4edff; color: var(--primary); border: 1px solid var(--line); }
.ghost { background: #f6f1ff; color: var(--primary); padding: 8px 11px; font-size: 13px; }
.icon-btn { background: rgba(255,255,255,.72); color: var(--primary); border: 1px solid rgba(124,58,237,.18); }
.small { padding: 9px 12px; font-size: 13px; white-space: nowrap; }
.full { width: 100%; margin-top: 10px; }
.danger, .danger-text { color: var(--danger) !important; }
.danger { background: #fff1f2; border-color: #fecdd3; }
.hidden { display: none !important; }
form label, .field-label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 7px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 15px; background: #fff; color: var(--text); outline: 0; padding: 12px 13px; margin-top: 7px; transition: .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-2); box-shadow: 0 0 0 4px rgba(124,58,237,.1); }
.field-grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: #f6f1ff; padding: 5px; border-radius: 17px; }
.segmented label { margin: 0; }
.segmented input { display: none; }
.segmented span { display: block; text-align: center; border-radius: 13px; padding: 11px; color: var(--muted); font-weight: 800; }
.segmented input:checked + span { color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 8px 14px rgba(124,58,237,.18); }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 12px; }
.filters input, .filters select { margin-top: 0; }
.filters input[type="search"] { grid-column: 1 / -1; }
.record-list { display: grid; gap: 10px; }
.record-card { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 13px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.record-title { font-weight: 800; margin-bottom: 4px; }
.record-meta { color: var(--muted); font-size: 12px; line-height: 1.6; }
.record-amount { text-align: right; font-weight: 900; font-size: 18px; }
.record-amount.income { color: var(--income); }
.record-amount.expense { color: var(--expense); }
.record-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.record-actions button { padding: 7px 10px; border-radius: 11px; background: #f7f2ff; color: var(--primary); font-size: 12px; }
.record-actions button:last-child { background: #fff1f2; color: var(--danger); }
.empty-list:empty::before { content: "暂无数据"; display: block; text-align: center; color: var(--muted); padding: 22px; border: 1px dashed var(--line); border-radius: 18px; background: rgba(255,255,255,.6); }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 9px; align-items: center; }
.inline-form input { margin: 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.account-tag { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; background: #f6f1ff; color: var(--primary); padding: 8px 10px; font-size: 13px; font-weight: 700; }
.account-tag button { width: 20px; height: 20px; border-radius: 50%; color: #fff; background: var(--primary-2); line-height: 1; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.file-btn { display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer; }
.tip, .help-list { color: var(--muted); font-size: 13px; line-height: 1.7; }
.help-list { padding-left: 18px; margin-bottom: 0; }
.donut-panel { text-align: center; }
.center-note { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
canvas { width: 100%; display: block; }
.cloud-panel { margin-top: 10px; }
.cloud-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 26px; padding: 0 10px; border-radius: 999px; background: #ede9fe; color: var(--primary); font-size: 12px; font-weight: 900; white-space: nowrap; }
.auth-switch { margin: 14px 0 4px; }
.cloud-form { margin-top: 12px; }
.divider { height: 1px; background: var(--line); margin: 16px 0 6px; }
.cloud-bar { display: grid; grid-template-columns: 1.1fr 1.4fr auto auto; gap: 10px; align-items: end; }
.cloud-bar label { margin: 0; }
.cloud-bar strong { display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tiny { margin: 0 0 4px; font-size: 11px; }
.invite-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.member-list { display: grid; gap: 8px; }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.66); }
.member-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-row strong { color: var(--primary); white-space: nowrap; }
.account-tag.disabled-tag { opacity: .62; }
button:disabled, input:disabled { cursor: not-allowed; opacity: .55; }
.bottom-nav { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 720px); z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.88); border-top: 1px solid rgba(232,222,252,.85); backdrop-filter: blur(18px); }
.bottom-nav button { border-radius: 16px; padding: 9px 4px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; }
.bottom-nav button.active { color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.toast { position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; z-index: 20; color: #fff; background: rgba(32,21,61,.92); border-radius: 999px; padding: 10px 16px; font-size: 13px; transition: .2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 380px) {
  .field-grid.two, .filters, .action-grid { grid-template-columns: 1fr; }
  .hero-card { align-items: flex-start; flex-direction: column; }
  h1 { font-size: 18px; }
}
@media (max-width: 640px) {
  .brand-image-card { aspect-ratio: 16 / 9; }
  .cloud-bar { grid-template-columns: 1fr; align-items: stretch; }
  .cloud-bar strong { max-width: 100%; }
  .invite-box { justify-content: space-between; }
}
@media (min-width: 900px) {
  .brand-image-card { aspect-ratio: 3 / 1; }
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #181226; --card: rgba(37, 27, 59, .92); --text: #f7f1ff; --muted: #c5b8db; --line: #42345f; --shadow: 0 18px 40px rgba(0,0,0,.24); }
  input, select, textarea, .record-card { background: #211832; color: var(--text); }
  .bottom-nav, .topbar { background: rgba(24,18,38,.82); }
}
