:root {
  --ink: #2B2118;
  --sub: #8A7B6C;
  --line: #E6DDCF;
  --bg: #F5F1EA;
  --brand: #6B4A2B;
  --gold: #C9A227;
  --danger: #C0392B;
  --warn: #D07A1B;
  --ok: #3E7C59;
  --card: #fff;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, var(--brand), #4A3220);
  color: #fff; padding: 14px 16px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 600; }
.topbar .sub { font-size: 12px; opacity: .75; margin-top: 2px; }
.topbar .act { background: rgba(255,255,255,.16); border: 0; color: #fff; border-radius: 20px; padding: 6px 12px; font-size: 13px; }

.view { padding: 12px 12px 84px; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 0 rgba(107,74,43,.06); }
.card-title { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.card-title .more { font-size: 12px; color: var(--sub); background: none; border: 0; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.kpi { background: var(--card); border-radius: 12px; padding: 10px 6px; text-align: center; }
.kpi b { display: block; font-size: 16px; font-weight: 600; }
.kpi span { font-size: 11px; color: var(--sub); }

.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--sub); font-size: 12px; }
.strong { font-weight: 600; }
.money { font-variant-numeric: tabular-nums; }
.wrap { flex-wrap: wrap; }

.list-item { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item.tap { cursor: pointer; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--bg); color: var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 600; flex: none; }
.tier { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: #F3EAD9; color: var(--brand); }

.badge { font-size: 11px; padding: 2px 7px; border-radius: 20px; white-space: nowrap; }
.badge-following { background: rgba(62,124,89,.12); color: var(--ok); }
.badge-warn { background: rgba(208,122,27,.14); color: var(--warn); }
.badge-pool { background: rgba(192,57,43,.12); color: var(--danger); }
.badge-info { background: rgba(107,74,43,.1); color: var(--brand); }
.badge-gold { background: rgba(201,162,39,.16); color: #8a6f14; }

.btn { border: 0; border-radius: 10px; padding: 10px 14px; font-size: 14px; background: #EFE7DA; color: var(--ink); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--sub); }
.btn-danger { background: rgba(192,57,43,.1); color: var(--danger); }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; }

.fab { position: fixed; right: 18px; bottom: 88px; width: 52px; height: 52px; border-radius: 50%; background: var(--gold); color: #fff; font-size: 26px; border: 0; box-shadow: 0 6px 16px rgba(201,162,39,.4); z-index: 15; }

.tabbar { position: fixed; bottom: 0; left: 0; right: 0; max-width: 520px; margin: 0 auto; display: flex; background: #fff; border-top: 1px solid var(--line); z-index: 18; }
.tabbar button { flex: 1; border: 0; background: none; padding: 8px 0 10px; font-size: 11px; color: var(--sub); }
.tabbar button.on { color: var(--brand); font-weight: 600; }
.tabbar .ico { display: block; font-size: 17px; line-height: 1.3; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.tabs button { border: 1px solid var(--line); background: #fff; color: var(--sub); border-radius: 20px; padding: 5px 12px; font-size: 13px; white-space: nowrap; }
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.input { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; font-size: 14px; color: var(--ink); }
.input:focus { outline: none; border-color: var(--brand); }
textarea.input { min-height: 84px; resize: vertical; }
.field { display: block; margin-bottom: 12px; }
.field-label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 5px; }
.field-hint { display: block; font-size: 11px; color: var(--sub); margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.reminder { border-left: 3px solid var(--line); padding: 10px 12px; margin-bottom: 8px; background: #FCFAF6; border-radius: 0 10px 10px 0; }
.reminder-danger { border-left-color: var(--danger); }
.reminder-warn { border-left-color: var(--warn); }
.reminder-info { border-left-color: var(--brand); }
.reminder .txt { font-size: 13px; }

.mask { position: fixed; inset: 0; background: rgba(43,33,24,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 40; }
.sheet { width: 100%; max-width: 520px; max-height: 88vh; background: #fff; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; transform: translateY(100%); }
.sheet-in { transform: translateY(0); transition: transform .22s ease; }
.sheet-out { transform: translateY(100%); transition: transform .18s ease; }
.sheet-wide { max-width: 520px; }
.sheet-head { padding: 14px 16px 8px; position: relative; border-bottom: 1px solid var(--line); }
.sheet-title { font-size: 16px; font-weight: 600; padding-right: 30px; }
.sheet-sub { font-size: 12px; color: var(--sub); margin-top: 3px; }
.sheet-x { position: absolute; right: 10px; top: 10px; border: 0; background: none; font-size: 22px; color: var(--sub); }
.sheet-body { padding: 14px 16px; overflow: auto; flex: 1; }
.sheet-foot { padding: 10px 16px 16px; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.sheet-foot .btn { flex: 1; }

.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(20px); background: rgba(43,33,24,.92); color: #fff; padding: 10px 16px; border-radius: 22px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: 84vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: rgba(192,57,43,.94); }

.empty { text-align: center; color: var(--sub); font-size: 13px; padding: 26px 10px; }
.spin { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; margin: 0 auto 8px; animation: rot 1s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

.spark { width: 100%; }
.spark-canvas { display: block; }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 76px 1fr 76px; align-items: center; gap: 8px; font-size: 12px; }
.bar-track { background: #F0E9DF; border-radius: 6px; height: 8px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--brand)); }
.bar-name { color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; }

.line-editor { border: 1px dashed var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.line-editor .grid-4 { display: grid; grid-template-columns: 1.3fr .6fr .8fr .8fr auto; gap: 6px; align-items: center; }
.thumb { width: 62px; height: 62px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.att-row { display: flex; gap: 8px; flex-wrap: wrap; }

.login-wrap { max-width: 520px; margin: 0 auto; padding: 56px 26px; min-height: 100vh; background: linear-gradient(160deg, #6B4A2B, #2B2118); color: #fff; }
.login-card { background: #fff; color: var(--ink); border-radius: 18px; padding: 22px 18px; margin-top: 22px; }
.login-brand { text-align: center; }
.login-brand h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: 2px; }
.login-brand p { margin: 0; opacity: .72; font-size: 13px; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.pin-pad button { padding: 14px 0; font-size: 18px; border-radius: 10px; border: 1px solid var(--line); background: #FBF8F3; }
.pin-dots { display: flex; gap: 10px; justify-content: center; margin: 12px 0; }
.pin-dots i { width: 12px; height: 12px; border-radius: 50%; background: #E6DDCF; display: block; }
.pin-dots i.on { background: var(--brand); }

.detail-hero { background: linear-gradient(135deg, var(--brand), #7C5A38); color: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.detail-hero h2 { margin: 0; font-size: 19px; }
.detail-hero .meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; opacity: .9; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat-row div { background: rgba(255,255,255,.14); border-radius: 10px; padding: 8px; text-align: center; font-size: 12px; }
.stat-row b { display: block; font-size: 15px; }

.feed { position: relative; padding-left: 16px; }
.feed::before { content: ''; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.feed-item { position: relative; padding: 0 0 14px 12px; }
.feed-item::before { content: ''; position: absolute; left: -8px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }
.feed-time { font-size: 11px; color: var(--sub); }

.pill-list { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 5px 12px; font-size: 13px; }
.pill.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.poster-preview { display: block; width: 100%; max-width: 260px; margin: 0 auto; border-radius: 12px; border: 1px solid var(--line); }
.share-link { word-break: break-all; background: #F7F2EA; border-radius: 8px; padding: 8px 10px; font-size: 12px; }
