﻿/* ===== 晚风 · 个人工作台 高级暗色主题 ===== */
:root {
  --bg: #0a0e1a;
  --bg-soft: #0e1424;
  --surface: rgba(255,255,255,.045);
  --surface-2: rgba(255,255,255,.07);
  --border: rgba(255,255,255,.09);
  --border-soft: rgba(255,255,255,.06);
  --text: #eef1f8;
  --muted: #8b93a7;
  --primary: #6c8cff;
  --primary-2: #9b6cff;
  --grad: linear-gradient(135deg, #6c8cff, #9b6cff);
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0,0,0,.45);
  --pill-finance: #f59e0b;
  --pill-growth: #6c8cff;
  --pill-family: #f472b6;
  --pill-health: #34d399;
  --pill-social: #22d3ee;
  --pill-review: #a78bfa;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  background-image: radial-gradient(1000px 500px at 85% -10%, rgba(108,140,255,.14), transparent 60%),
                    radial-gradient(800px 400px at -10% 110%, rgba(155,108,255,.12), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
.hidden { display: none !important; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 登录页 ---------- */
#loginView { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
  background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.02));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 44px 36px 36px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(18px);
  text-align: center;
}
.login-logo {
  width: 64px; height: 64px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; border-radius: 20px;
  background: var(--grad);
  box-shadow: 0 10px 30px rgba(108,140,255,.4);
}
.login-card h1 { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 8px 0 26px; }
.login-card .form-control {
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  color: var(--text); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px;
}
.login-card .form-control:focus { background: rgba(255,255,255,.08); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,140,255,.18); color: var(--text); }
.login-btn {
  width: 100%; padding: 12px; border: none; border-radius: 12px;
  background: var(--grad); color: #fff; font-size: 15px; font-weight: 600;
  letter-spacing: 6px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(108,140,255,.35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(108,140,255,.45); }
.login-btn:active { transform: translateY(0); }
.login-err { color: var(--danger); font-size: 13px; margin-top: 14px; min-height: 18px; }

/* ---------- 布局 ---------- */
#appView { display: flex; min-height: 100vh; }
#sidebar {
  width: 224px; flex-shrink: 0;
  background: linear-gradient(180deg, #0c1120, #0a0e1a);
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 20px 14px;
}
.side-logo { font-size: 18px; font-weight: 800; padding: 4px 10px 18px; letter-spacing: 1px; }
.side-logo span { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
#sidebar nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px;
  color: var(--muted); text-decoration: none; cursor: pointer;
  font-size: 14px; font-weight: 500;
  transition: all .18s ease;
  border: 1px solid transparent;
}
.nav-item i { font-size: 17px; width: 20px; text-align: center; }
.nav-item:hover { color: var(--text); background: var(--surface); }
.nav-item.active {
  color: #fff; font-weight: 600;
  background: linear-gradient(135deg, rgba(108,140,255,.22), rgba(155,108,255,.16));
  border-color: rgba(108,140,255,.35);
  box-shadow: inset 0 0 20px rgba(108,140,255,.08);
}
.side-foot { padding-top: 14px; border-top: 1px solid var(--border-soft); }
.user-chip { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; color: var(--muted); font-size: 13px; }
.btn-logout { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 10px; padding: 5px 12px; cursor: pointer; font-size: 12px; transition: all .15s; }
.btn-logout:hover { color: var(--danger); border-color: rgba(248,113,113,.4); }

#main { flex: 1; min-width: 0; padding: 22px 26px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 10px; }
.topbar h2 { font-size: 22px; font-weight: 700; }
.top-date { color: var(--muted); font-size: 13px; margin-left: 10px; }
.top-right { display: flex; gap: 8px; }
.chip { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 6px 14px; font-size: 12px; color: var(--muted); }
.chip b { color: var(--text); }
.page { display: none; animation: fadeIn .25s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 卡片 ---------- */
.card-g {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
  transition: transform .18s ease, border-color .18s ease;
}
.card-g:hover { border-color: rgba(255,255,255,.14); }
.card-title { font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--primary); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* 统计卡 */
.stat-card { position: relative; overflow: hidden; }
.stat-card .num { font-size: 30px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-card .lbl { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat-card .ic { position: absolute; right: 14px; top: 14px; font-size: 22px; opacity: .35; }

/* 今日任务卡 */
.main-title { font-size: 21px; font-weight: 700; line-height: 1.45; }
.main-meta { color: var(--muted); font-size: 13px; margin: 8px 0 12px; }
.reason-box {
  background: rgba(108,140,255,.08);
  border-left: 3px solid var(--primary);
  padding: 12px 14px; border-radius: 10px;
  font-size: 14px; line-height: 1.7; margin: 12px 0;
}
.chain-line { color: var(--muted); font-size: 12px; margin-top: 8px; }
.btn { border-radius: 12px; padding: 9px 18px; font-size: 14px; border: none; cursor: pointer; transition: all .15s ease; font-weight: 600; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(108,140,255,.3); }
.btn-primary:hover { box-shadow: 0 10px 24px rgba(108,140,255,.4); transform: translateY(-1px); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-ok { background: var(--ok); color: #06251a; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 9px; }
.btn-danger-ghost { background: none; border: 1px solid rgba(248,113,113,.35); color: var(--danger); }
.btn-danger-ghost:hover { background: rgba(248,113,113,.12); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* 进度条 */
.progress-track { height: 10px; background: rgba(255,255,255,.07); border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 10px; background: var(--grad); transition: width .8s cubic-bezier(.22,1,.36,1); }
.pillar-row { margin-bottom: 16px; }
.pillar-row .p-head { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.pillar-row .p-head .pct { color: var(--muted); font-size: 12px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; }
.p-finance .progress-fill { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.p-growth .progress-fill { background: linear-gradient(90deg, #6c8cff, #9b6cff); }
.p-family .progress-fill { background: linear-gradient(90deg, #f472b6, #fbbf24); }
.p-health .progress-fill { background: linear-gradient(90deg, #34d399, #22d3ee); }

/* 表单 */
.form-control, .form-select {
  background: rgba(255,255,255,.05) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: 10px !important;
  padding: 9px 12px !important;
}
.form-control:focus, .form-select:focus { border-color: var(--primary) !important; box-shadow: 0 0 0 3px rgba(108,140,255,.15) !important; }
.form-label { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.form-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }

/* 列表 */
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 4px; border-bottom: 1px dashed var(--border-soft); font-size: 14px; }
.list-item:last-child { border-bottom: none; }
.list-item .li-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.list-item .li-main { min-width: 0; }
.list-item .li-title { font-weight: 500; }
.list-item .li-sub { color: var(--muted); font-size: 12px; }
.pill { font-size: 11px; padding: 3px 10px; border-radius: 20px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: rgba(52,211,153,.14); color: var(--ok); }
.pill.warn { background: rgba(251,191,36,.13); color: var(--warn); }
.pill.blue { background: rgba(108,140,255,.14); color: var(--primary); }
.pill.red { background: rgba(248,113,113,.13); color: var(--danger); }

/* 工具网格 */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tool-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 14px; text-align: center; cursor: pointer;
  transition: all .18s ease; text-decoration: none; color: var(--text); position: relative;
}
.tool-card:hover { transform: translateY(-3px); border-color: rgba(108,140,255,.4); box-shadow: 0 10px 26px rgba(0,0,0,.4); }
.tool-card .t-ic { font-size: 26px; margin-bottom: 8px; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.tool-card .t-name { font-size: 13px; font-weight: 600; }
.tool-card .t-cat { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tool-del { position: absolute; top: 6px; right: 8px; background: none; border: none; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .15s; }
.tool-card:hover .tool-del { opacity: 1; }
.tool-del:hover { color: var(--danger); }

/* 消息 */
.msg-item { padding: 12px 4px; border-bottom: 1px dashed var(--border-soft); }
.msg-item .m-title { font-weight: 600; }
.msg-item .m-body { color: var(--muted); font-size: 13px; margin-top: 3px; white-space: pre-wrap; }
.msg-item .m-at { color: var(--muted); font-size: 11px; margin-top: 4px; }

/* 表格 */
.table-g { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-g th { color: var(--muted); font-weight: 600; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table-g td { padding: 9px 10px; border-bottom: 1px dashed var(--border-soft); }
.table-g tr:hover td { background: rgba(255,255,255,.025); }
.amount-inc { color: var(--ok); font-weight: 600; }
.amount-exp { color: var(--danger); font-weight: 600; }

/* 空状态 */
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 26px 0; }
.section-note { color: var(--muted); font-size: 12px; margin-top: 8px; line-height: 1.7; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* 移动端 */
@media (max-width: 900px) {
  #sidebar { width: 68px; padding: 14px 8px; }
  .side-logo { font-size: 0; padding: 8px 0 14px; text-align: center; }
  .side-logo::before { content: "🌙"; font-size: 20px; }
  .nav-item { justify-content: center; padding: 12px 0; }
  .nav-item span { display: none; }
  .user-chip { flex-direction: column; gap: 8px; }
  #main { padding: 16px 14px 60px; }
}

/* ---------- 学习页 ---------- */
.tab-row { display: inline-flex; gap: 4px; margin-left: 10px; flex-wrap: wrap; }
.tab { font-size: 12px; padding: 3px 12px; border-radius: 20px; background: var(--surface-2); color: var(--muted); cursor: pointer; transition: all .15s; border: 1px solid transparent; }
.tab:hover { color: var(--text); }
.tab.on { background: var(--grad); color: #fff; }
.book-list { display: flex; flex-direction: column; gap: 8px; }
.book-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; flex-wrap: wrap; }
.book-item .li-main, .res-item .li-main { min-width: 0; flex: 1; }
.book-head { display: flex; align-items: center; gap: 8px; }
.book-title { font-weight: 600; }
.status-seg { display: inline-flex; background: rgba(255,255,255,.05); border-radius: 8px; padding: 2px; margin-left: auto; }
.status-seg .seg { font-size: 11px; padding: 3px 9px; border-radius: 7px; color: var(--muted); cursor: pointer; transition: all .15s; border: none; background: none; }
.status-seg .seg:hover { color: var(--text); }
.status-seg .seg.on { background: var(--primary); color: #fff; }
.res-list { display: flex; flex-direction: column; gap: 8px; }
.res-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: var(--text); position: relative; transition: all .15s; }
.res-item:hover { border-color: rgba(108,140,255,.4); transform: translateY(-1px); }
.res-item > i { font-size: 20px; color: var(--primary); }
.concept-card { background: linear-gradient(135deg, rgba(108,140,255,.12), rgba(155,108,255,.08)); border-color: rgba(108,140,255,.25); }
.concept-title { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.concept-body { color: var(--text); font-size: 14px; line-height: 1.8; }
.path-line { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border-soft); font-size: 13px; }
.path-line:last-child { border-bottom: none; }
.path-n { width: 20px; height: 20px; flex-shrink: 0; border-radius: 50%; background: var(--grad); color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; font-weight: 700; margin-top: 2px; }

/* ---------- 健康同步 ---------- */
.sync-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.sync-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 7px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.sync-pill i { color: var(--primary); }
.chart-box { height: 220px; position: relative; }
