:root { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0; padding: 24px 16px 64px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0f1115; color: #e7e7ea; line-height: 1.6;
}
.wrap { max-width: 760px; margin: 0 auto; }
h1 { font-size: 20px; margin: 0; letter-spacing: .5px; }
.muted { color: #8b8f98; font-size: 13px; }
.err { color: #ff7b72; font-size: 13px; min-height: 20px; margin: 8px 0 0; }
.ok { color: #6ee7a8; font-size: 13px; }
.hidden { display: none !important; }

header { display: flex; align-items: center; justify-content: space-between; }
.head-right { display: flex; align-items: center; gap: 10px; }

.card {
  background: #171a21; border: 1px solid #262b35; border-radius: 10px;
  padding: 18px; margin-top: 16px;
}

input, textarea, button, select {
  font: inherit; color: inherit; border-radius: 8px;
  border: 1px solid #2f3542; background: #10131a; padding: 9px 12px;
}
input, textarea { width: 100%; }
textarea { resize: vertical; min-height: 88px; font-family: inherit; }
input:focus, textarea:focus { outline: none; border-color: #4b7bec; }
button { background: #2d6cdf; border-color: #2d6cdf; cursor: pointer; white-space: nowrap; }
button:hover { background: #3a7bf0; }
button:disabled { opacity: .5; cursor: default; }
button.ghost { background: transparent; border-color: #2f3542; color: #b7bcc7; }
button.ghost:hover { background: #1d2129; }
button.danger { background: transparent; border-color: #5a2a2a; color: #ff7b72; }
button.danger:hover { background: #2a1517; }
button.sm { padding: 5px 10px; font-size: 13px; }

.row { display: flex; gap: 10px; margin-bottom: 10px; }
.row > * { flex: 1; }
.row.tight > * { flex: 0 0 auto; }

nav#tabs { display: flex; gap: 4px; margin-top: 18px; border-bottom: 1px solid #1e222b; overflow-x: auto; scrollbar-width: none; }
nav#tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  border-radius: 0; color: #8b8f98; padding: 9px 12px;
}
.tab:hover { background: transparent; color: #cfd3da; }
.tab.active { color: #e7e7ea; border-bottom-color: #2d6cdf; }

.list { list-style: none; padding: 0; margin: 20px 0 0; }
.list li { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid #1e222b; }
.list li:last-child { border-bottom: none; }
.list time { color: #7d828c; font-size: 12px; flex: 0 0 128px; padding-top: 2px; }
.ev-main { flex: 1; min-width: 0; }
.ev-main strong { font-weight: 600; }
.amt { color: #6ee7a8; font-size: 13px; margin-left: 6px; }
.note { margin: 4px 0 0; color: #a7adb8; font-size: 13px; white-space: pre-wrap; word-break: break-word; }

.note-card { padding: 14px 0; border-bottom: 1px solid #1e222b; }
.note-card:last-child { border-bottom: none; }
.note-card h3 { margin: 0 0 6px; font-size: 15px; }
.list .body { color: #a7adb8; font-size: 13px; white-space: pre-wrap; word-break: break-word; max-height: 120px; overflow: hidden; }
.note-actions { display: flex; gap: 8px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.card-list { margin-top: 8px; border-top: 1px solid #1b1f27; }
.card-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #1b1f27;
}
.card-row:last-child { border-bottom: none; }
.card-row-front { flex: 1; font-size: 13px; color: #b7bcc7; word-break: break-word; }
.card-row-front.dim { color: #6b707a; text-decoration: line-through; }

/* 主体 */
.entity-list { margin-top: 8px; }
.entity-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #1b1f27;
}
.entity-item:last-child { border-bottom: none; }
.entity-name { flex: 1; font-size: 14px; }
.entity-tag {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  border-radius: 4px; background: #1d2532; color: #8fb4f0; font-size: 12px;
}
.inline-form { margin-top: 10px; padding: 12px; background: #0b0e14; border: 1px solid #333a47; border-radius: 8px; }
/* 输入框必须比容器亮，否则在深色底上完全看不出边界 */
.inline-form input, .inline-form textarea { background: #161b25; border-color: #3c4456; }
.inline-form input::placeholder, .inline-form textarea::placeholder { color: #6b7280; }

#lock-card { text-align: center; }
#lock-card h1 { margin-bottom: 4px; }
#lock-card form { margin-top: 14px; display: flex; gap: 8px; }

/* 复习 */
.review-head { display: flex; gap: 16px; align-items: baseline; }
.review-head .num { font-size: 28px; font-weight: 600; }
.qcard {
  background: #171a21; border: 1px solid #262b35; border-radius: 12px;
  padding: 28px 20px; margin-top: 16px; min-height: 180px;
  display: flex; flex-direction: column; justify-content: center; text-align: center;
}
.qcard .q { font-size: 19px; line-height: 1.5; white-space: pre-wrap; }
.qcard .a { margin-top: 20px; padding-top: 20px; border-top: 1px dashed #2f3542; color: #cfd3da; white-space: pre-wrap; }
.qcard .hint { color: #6b707a; font-size: 13px; }
.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.rate button { padding: 12px 6px; font-size: 14px; }
.rate .r1 { background: #8b2d2d; border-color: #8b2d2d; }
.rate .r2 { background: #7a5a1f; border-color: #7a5a1f; }
.rate .r3 { background: #2d6cdf; border-color: #2d6cdf; }
.rate .r4 { background: #2a7a4d; border-color: #2a7a4d; }
.rate small { display: block; font-size: 11px; opacity: .8; margin-top: 2px; }
.empty { text-align: center; padding: 40px 0; color: #6b707a; }

/* 账本 */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.acct-item {
  background: #10131a; border: 1px solid #262b35; border-radius: 8px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 2px;
}
.acct-item strong { font-size: 16px; }
.amt.out { color: #ff9b8a; }
.section-title { margin: 20px 0 0; font-size: 13px; color: #8b8f98; }
select { width: 100%; }
.btn-link {
  display: inline-block; padding: 5px 12px; font-size: 13px;
  border: 1px solid #2f3542; border-radius: 8px;
  color: #b7bcc7; text-decoration: none;
}
.btn-link:hover { background: #1d2129; }
.due-tag {
  display: inline-block; padding: 1px 7px; border-radius: 4px;
  background: #4a2318; color: #ffb38a; font-size: 12px; margin-left: 4px;
}

/* 任务 */
.task-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-top: 20px;
}
.task-date { font-size: 15px; font-weight: 600; letter-spacing: .3px; }
.task-count { font-size: 13px; color: #8b8f98; }

.task-section { margin-top: 18px; }
.task-section h4 {
  margin: 0 0 4px; font-size: 12px; font-weight: 500;
  color: #7d828c; letter-spacing: .6px;
}

.task-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 2px; border-bottom: 1px solid #1b1f27;
  transition: opacity .28s ease, transform .28s ease;
}
.task-item:last-child { border-bottom: none; }
.task-item.overdue { border-left: 2px solid #c9773a; padding-left: 12px; }
.task-item.done { opacity: 0; transform: translateX(10px); }

.task-check {
  flex: 0 0 22px; width: 22px; height: 22px; margin-top: 1px;
  border-radius: 50%; border: 1.5px solid #3c4456;
  background: transparent; padding: 0; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.task-check:hover { border-color: #4b7bec; background: rgba(75,123,236,.12); }
.task-check:active { background: rgba(75,123,236,.25); }

.task-content { flex: 1; min-width: 0; }
.task-title { font-size: 15px; line-height: 1.45; word-break: break-word; }
.task-meta { font-size: 12px; color: #7d828c; margin-top: 2px; }
.task-more {
  background: transparent; border: none; padding: 2px 8px;
  color: #6b707a; font-size: 16px; line-height: 1; cursor: pointer;
}
.task-more:hover { background: #1d2129; color: #cfd3da; }

.add-btn {
  width: 100%; margin-top: 18px; padding: 12px;
  background: transparent; border: 1px dashed #333a47; color: #8b8f98;
}
.add-btn:hover { background: #141821; color: #cfd3da; border-color: #4a5265; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.chip {
  flex: 0 0 auto; padding: 6px 13px; border-radius: 999px;
  border: 1px solid #2f3542; background: transparent;
  color: #b7bcc7; font-size: 13px;
}
.chip:hover { background: #1a1e26; }
.chip.on { background: #2d6cdf; border-color: #2d6cdf; color: #fff; }

.inline-check {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; font-size: 13px; color: #a7adb8;
}
.inline-check input { width: auto; }

.task-menu {
  position: absolute; z-index: 50; width: 168px;
  background: #1b2029; border: 1px solid #2f3542; border-radius: 10px;
  padding: 4px; box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.task-menu button {
  display: block; width: 100%; text-align: left;
  background: transparent; border: none; border-radius: 6px;
  padding: 9px 11px; font-size: 13px; color: #cfd3da;
}
.task-menu button:hover { background: #252b36; }
.task-menu button.danger { color: #ff7b72; }

.rule-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 2px; border-bottom: 1px solid #1b1f27;
}
.rule-item:last-child { border-bottom: none; }
.rule-content { flex: 1; min-width: 0; }
.rule-title { font-size: 14px; }
.rule-meta { font-size: 12px; color: #7d828c; margin-top: 1px; }

/* 健康 */
.health-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-top: 20px;
}
.h-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.h-card {
  text-align: left; background: #171a21; border: 1px solid #262b35;
  border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 5px;
  min-height: 82px;
}
.h-card:hover { background: #1b1f27; border-color: #333a47; }
.h-card.wide { grid-column: 1 / -1; }
.h-name { font-size: 12px; color: #8b8f98; }
.h-value { font-size: 20px; font-weight: 600; letter-spacing: .3px; }
.h-value.small {
  font-size: 15px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.h-unit { font-size: 12px; color: #7d828c; font-weight: 400; }
.h-bar { height: 4px; border-radius: 2px; background: #242a34; overflow: hidden; margin-top: 4px; }
.h-bar i {
  display: block; height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, #2d6cdf, #4f8ff7);
  transition: width .3s ease;
}
.trend-row {
  display: flex; gap: 14px; padding: 8px 2px;
  border-bottom: 1px solid #1b1f27; font-size: 13px; color: #a7adb8;
}
.trend-row:last-child { border-bottom: none; }
.trend-day { color: #7d828c; width: 42px; flex: 0 0 42px; }

/* 预算 */
.budget-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: #b7bcc7;
}
.budget-item { margin-top: 12px; }
.budget-line {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; margin-bottom: 5px;
}
.acct-item.credit { cursor: pointer; border-color: #3a3145; }
.acct-item.credit:hover { background: #1b1f27; }
.acct-sub { font-size: 11px; color: #7d828c; }
.stmt-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid #1b1f27; gap: 10px;
}
.stmt-row:last-child { border-bottom: none; }
.stmt-main { font-size: 13px; }
.stmt-meta { font-size: 12px; color: #8b8f98; white-space: nowrap; }

/* 首页 */
.home-head { margin-top: 20px; }
.home-hero {
  width: 100%; margin-top: 18px; padding: 26px 20px;
  background: #171a21; border: 1px solid #262b35; border-radius: 14px;
  text-align: left; display: flex; align-items: baseline; gap: 12px;
}
.home-hero:hover { background: #1b1f27; border-color: #333a47; }
.home-hero-num { font-size: 40px; font-weight: 650; line-height: 1; letter-spacing: -.5px; }
.home-hero-label { font-size: 14px; color: #a7adb8; }

.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.home-cell {
  text-align: left; padding: 14px; border-radius: 12px;
  background: #141821; border: 1px solid #232833;
  display: flex; flex-direction: column; gap: 4px;
}
.home-cell:hover { background: #181d27; border-color: #2f3542; }
.home-cell.warn { border-color: #3d2b1e; background: #1b1610; }
.home-cell-label { font-size: 12px; color: #8b8f98; }
.home-cell strong { font-size: 16px; font-weight: 600; }

.home-quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }

/* 提醒 */
.inbox-list { margin-top: 6px; }
.inbox-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px; margin-top: 8px;
  background: #1b1610; border: 1px solid #3b2a1c; border-radius: 10px;
}
.inbox-main { flex: 1; min-width: 0; }
.inbox-title { font-size: 14px; }
.inbox-detail { font-size: 12px; color: #9a8b7a; margin-top: 2px; }

/* 回流提示 */
.attention {
  margin-top: 16px; padding: 14px 16px;
  background: #1b1610; border: 1px solid #4a3520; border-radius: 10px;
}
.attention h3 { margin: 0 0 10px; font-size: 14px; color: #e8b06a; letter-spacing: .3px; }
.att-item { padding: 8px 0; border-top: 1px solid #33261a; }
.att-item:first-of-type { border-top: none; padding-top: 0; }
.att-item strong { display: block; font-size: 14px; }
.att-item .muted { display: block; margin-top: 2px; }
.mini { list-style: none; margin: 8px 0 0; padding: 0; }
.mini li { font-size: 13px; color: #cfd3da; padding: 3px 0 3px 12px; position: relative; }
.mini li:before { content: '·'; position: absolute; left: 2px; color: #8b6b3d; }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(12px);
  background: #262b35; color: #e7e7ea; padding: 10px 16px; border-radius: 8px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
