  :root {
    --bg: #f6f7fb;
    --card: #ffffff;
    --ink: #1e293b;
    --ink2: #64748b;
    --line: #e5e9f0;
    --accent: #4f6ef7;
    --accent-soft: #eef1fe;
    --danger: #ef4444;
    --radius: 14px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .05);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.6;
  }
  .wrap { max-width: 860px; margin: 0 auto; padding: 20px 16px 80px; }

  /* 顶栏 */
  header {
    position: sticky; top: 0; z-index: 20;
    background: rgba(246,247,251,.92); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .topbar { max-width: 860px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .logo { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
  .logo .dot { color: var(--accent); }
  .tabs { display: flex; gap: 6px; background: #eceff7; border-radius: 10px; padding: 3px; }
  .tabs button {
    border: 0; background: transparent; padding: 6px 16px; border-radius: 8px;
    font-size: 14px; color: var(--ink2); cursor: pointer; font-family: inherit;
  }
  .tabs button.active { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 4px rgba(15,23,42,.10); }
  .top-actions { margin-left: auto; display: flex; gap: 8px; }
  .icon-btn {
    border: 1px solid var(--line); background: var(--card); color: var(--ink2);
    border-radius: 8px; padding: 5px 10px; font-size: 13px; cursor: pointer; font-family: inherit;
  }
  .icon-btn:hover { color: var(--ink); border-color: #cbd5e1; }

  /* 快捷打卡 */
  .quick { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 6px; }
  .quick button {
    border: 1px solid var(--line); background: var(--card); border-radius: 20px;
    padding: 8px 14px; font-size: 14px; cursor: pointer; font-family: inherit;
    display: flex; align-items: center; gap: 6px; box-shadow: var(--shadow); color: var(--ink);
    transition: transform .08s ease;
  }
  .quick button:active { transform: scale(.96); }
  .quick button .ico { font-size: 15px; }

  .card {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    border: 1px solid rgba(229,233,240,.6);
  }

  /* 主按钮 */
  .btn {
    border: 0; background: var(--accent); color: #fff; border-radius: 10px;
    padding: 10px 20px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
  }
  .btn:hover { filter: brightness(1.05); }
  .btn.ghost { background: var(--accent-soft); color: var(--accent); }
  .btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
  .btn.danger { background: #fee2e2; color: var(--danger); }
  .btn.danger:hover { filter: none; background: #fecaca; }

  /* 记录列表 */
  .day-group { margin-top: 18px; }
  .day-title { display: flex; align-items: baseline; gap: 8px; margin: 14px 2px 8px; }
  .day-title .d { font-size: 15px; font-weight: 700; }
  .day-title .rel { font-size: 12px; color: var(--ink2); }
  .day-title .sum { font-size: 12px; color: var(--ink2); margin-left: auto; }

  .rec {
    padding: 12px 14px; margin-bottom: 10px; position: relative;
    border-left: 4px solid var(--accent);
  }
  .rec-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .badge {
    font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 20px;
    color: #fff; white-space: nowrap;
  }
  .rec-time { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .rec-dur { font-size: 12px; color: var(--ink2); }
  .ongoing {
    font-size: 12px; color: #b45309; background: #fef3c7; border-radius: 6px; padding: 1px 8px;
    display: inline-flex; align-items: center; gap: 4px;
  }
  .ongoing .pulse { width: 6px; height: 6px; border-radius: 50%; background: #f59e0b; animation: pulse 1.2s infinite; }
  @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.25} }
  .rec-meta { margin-top: 4px; font-size: 13.5px; }
  .rec-meta .act { color: var(--ink2); }
  .rec-note { font-size: 13.5px; color: var(--ink2); margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
  .img-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
  .img-thumb { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden;
    border: 1px solid var(--line); background: var(--bg2); }
  .img-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
  .img-thumb .rm { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%;
    border: none; background: rgba(15,23,42,.72); color: #fff; font-size: 12px; line-height: 1; cursor: pointer; }
  .img-edit-bar { display: flex; align-items: center; gap: 10px; }
  .txn-amount { font-size: 14px; font-weight: 600; color: #0369a1; }
  .rec-ops { margin-left: auto; display: flex; gap: 6px; }
  .rec-ops button {
    border: 1px solid var(--line); background: transparent; border-radius: 6px;
    font-size: 12px; padding: 2px 8px; cursor: pointer; color: var(--ink2); font-family: inherit;
  }
  .rec-ops button:hover { color: var(--ink); }
  .empty { text-align: center; color: var(--ink2); padding: 60px 20px; font-size: 14px; }
  .empty .big { font-size: 42px; margin-bottom: 10px; }
  #loadMore { display: block; margin: 16px auto; }

  /* 统计页 */
  .stats-head { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; flex-wrap: wrap; }
  .stats-head h2 { font-size: 17px; }
  .stats-head input[type="date"] {
    border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 14px;
    font-family: inherit; background: var(--card); color: var(--ink);
  }
  .nav-d { border: 1px solid var(--line); background: var(--card); border-radius: 8px; width: 30px; height: 32px; cursor: pointer; color: var(--ink2); font-size: 15px; }
  .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .stat { padding: 14px 16px; }
  .stat .k { font-size: 12.5px; color: var(--ink2); display: flex; align-items: center; gap: 5px; }
  .stat .v { font-size: 21px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
  .stat .v small { font-size: 12px; color: var(--ink2); font-weight: 500; margin-left: 4px; }
  .stat .sub { font-size: 12px; color: var(--ink2); margin-top: 2px; }

  .chart-card { margin-top: 14px; padding: 16px 18px; }
  .chart-card h3 { font-size: 14.5px; margin-bottom: 10px; color: var(--ink); }
  .chart { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
  .bar-row { display: flex; align-items: flex-end; gap: 7px; }
  .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
  .bar-wrap { width: 100%; height: 104px; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line); }
  .bar { width: 100%; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #6366f1, #4f46e5); min-height: 2px; position: relative; transition: height .2s; }
  .bar-val { font-size: 11.5px; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
  .bar-label { font-size: 11px; color: var(--ink2); white-space: nowrap; }

  /* 趋势看板 */
  .trend-card { margin-top: 14px; padding: 16px 18px; }
  .trend-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
  .trend-head h3 { font-size: 14.5px; margin: 0; }
  .period-tabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
  .period-tabs button { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 5px 11px; font-size: 13px; cursor: pointer; color: var(--ink2); font-family: inherit; }
  .period-tabs button.active { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; font-weight: 600; }
  .period-tabs .export-btn { border-color: #0ea5e9; color: #0ea5e9; }
  .period-tabs .export-btn:hover { background: #f0f9ff; }
  .trend-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
  .trend-grid .chart-card { margin-top: 0; padding: 12px 14px; }
  .trend-grid .chart-card h4 { font-size: 13.5px; margin: 0 0 8px; color: var(--ink); }
  .trend-grid .chart { gap: 10px; }
  .bar-mark { box-shadow: 0 0 0 2px #f43f5e inset; border-radius: 6px 6px 3px 3px; }
  /* 心情占比面板 */
  .mood-share-card #moodShare { padding: 4px 2px; }
  .ms-bar { display: flex; height: 18px; border-radius: 9px; overflow: hidden; background: #eef1f7; }
  .ms-seg { height: 100%; }
  .ms-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 13px; color: var(--ink2); }
  .ms-leg { display: inline-flex; align-items: center; gap: 5px; }
  .ms-leg i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
  /* 交易金额看板 */
  .txn-board { margin-top: 16px; padding: 16px 18px; }
  .txn-board .trend-head { margin-bottom: 6px; }
  .txn-sub { font-size: 13.5px; color: var(--ink); margin: 16px 0 8px; }
  .txn-stack { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
  .ts-row { display: flex; align-items: flex-end; gap: 6px; }
  .ts-col { flex: 1; min-width: 16px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
  .ts-val { font-size: 10px; color: var(--ink); font-weight: 600; white-space: nowrap; }
  .ts-wrap { width: 100%; height: 112px; display: flex; flex-direction: column; justify-content: flex-end; background: #f6f8fc; border-radius: 4px; }
  .ts-seg { width: 100%; min-height: 2px; border-radius: 2px 2px 0 0; }
  .ts-label { font-size: 10px; color: var(--ink2); white-space: nowrap; }
  .txn-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
  .txn-tbl th, .txn-tbl td { padding: 7px 8px; text-align: right; border-bottom: 1px solid var(--line); }
  .txn-tbl th:first-child, .txn-tbl td:first-child { text-align: left; }
  .txn-tbl thead th { color: var(--ink2); font-weight: 600; background: #f6f8fc; }
  .txn-tbl tbody tr:hover { background: #fafbff; }
  .txn-tbl .t-sum td { background: #eef4ff; font-weight: 600; border-top: 2px solid var(--line); }
  .txn-tbl .t-avg td { background: #fbf7ef; color: var(--ink2); }
  .txn-cell { cursor: pointer; }
  .txn-cell:hover { background: #eaf3ff; text-decoration: underline; }
  .txn-chart-hint { font-size: 12px; color: var(--ink2); margin: 4px 0 8px; }
  .txn-chart-hint .lk { color: var(--blue, #2563eb); font-weight: 600; }
  .txn-monthly-chart { overflow-x: auto; padding: 4px 2px 8px; }
  .tm-row { display: flex; gap: 10px; align-items: flex-end; min-height: 150px; }
  .tm-col { display: flex; flex-direction: column; align-items: center; min-width: 44px; }
  .tm-val { font-size: 11px; color: var(--ink2); margin-bottom: 3px; height: 14px; white-space: nowrap; }
  .tm-wrap { width: 26px; height: 120px; display: flex; flex-direction: column-reverse; background: #f4f7fb; border-radius: 4px; overflow: hidden; cursor: pointer; }
  .tm-seg { width: 100%; cursor: pointer; }
  .tm-seg:hover { filter: brightness(1.08); outline: 1px solid rgba(0,0,0,.15); }
  .tm-label { font-size: 11px; color: var(--ink2); margin-top: 4px; text-align: center; white-space: nowrap; }
  .txn-detail-sub { font-size: 13px; color: var(--ink2); margin: 0 0 10px; }
  .txn-detail-list { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
  .td-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
  .td-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
  .td-date { color: var(--ink2); }
  .td-amt { font-weight: 700; color: var(--ink); }
  .td-cat { font-size: 12.5px; margin-top: 2px; color: var(--ink); }
  .td-place { font-size: 12px; color: var(--ink2); margin-top: 1px; }
  .td-note { font-size: 12px; color: var(--ink2); margin-top: 3px; white-space: pre-wrap; }
  .td-tags { margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
  .td-tag { font-size: 11px; padding: 1px 6px; border-radius: 10px; background: #eef2f7; color: var(--ink2); }
  .td-tag.td-ab { background: #fee2e2; color: #b91c1c; }
  .muted { color: var(--ink2); font-size: 13px; }

  .tl-card { margin-top: 14px; padding: 16px 18px; }
  .tl-card h3 { font-size: 14.5px; margin-bottom: 10px; }
  .tl-row { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; align-items: baseline; }
  .tl-row:last-child { border-bottom: 0; }
  .tl-time { color: var(--ink2); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12.5px; min-width: 92px; }
  .tl-txt { flex: 1; min-width: 0; }
  .tl-txt .a { color: var(--ink); }
  .tl-txt .n { color: var(--ink2); font-size: 12.5px; }

  /* 弹窗 */
  dialog {
    border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px));
    box-shadow: 0 24px 64px rgba(15, 23, 42, .25); color: var(--ink);
  }
  dialog::backdrop { background: rgba(15, 23, 42, .4); }
  .dlg-body { padding: 22px 22px 18px; max-height: 82vh; overflow-y: auto; }
  .dlg-body h3 { font-size: 17px; margin-bottom: 14px; }
  .frow { margin-bottom: 13px; }
  .frow label { display: block; font-size: 13px; font-weight: 600; color: var(--ink2); margin-bottom: 5px; }
  .frow input, .frow select, .frow textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px;
    font-size: 14.5px; font-family: inherit; background: #fbfcfe; color: var(--ink);
  }
  .frow input:focus, .frow select:focus, .frow textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
  .frow textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
  .time-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .now-btn { font-size: 12px; color: var(--accent); cursor: pointer; background: none; border: 0; padding: 0; font-family: inherit; }
  .now-btn:hover { text-decoration: underline; }
  .hint { font-size: 12px; color: #94a3b8; margin-top: 3px; }
  .dlg-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px 20px; border-top: 1px solid var(--line); position: sticky; background: var(--card); bottom: 0; border-radius: 0 0 16px 16px; }

  .toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(80px);
    background: #1e293b; color: #fff; padding: 9px 18px; border-radius: 10px; font-size: 14px;
    opacity: 0; transition: all .25s ease; z-index: 99; pointer-events: none; max-width: 80vw; text-align: center;
  }
  .toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
  #importFile { display: none; }

  /* 登录门 */
  #authGate {
    position: fixed; inset: 0; z-index: 50; display: none;
    background: linear-gradient(160deg, #eef1fb 0%, #f6f7fb 60%);
    align-items: center; justify-content: center; padding: 20px;
  }
  #authGate.show { display: flex; }
  .auth-card {
    width: min(380px, 100%); background: var(--card); border-radius: 20px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, .16); padding: 30px 28px 26px; text-align: center;
  }
  .auth-card .lock { font-size: 40px; }
  .auth-card h2 { font-size: 19px; margin: 6px 0 4px; }
  .auth-card .sub { font-size: 13px; color: var(--ink2); margin-bottom: 18px; }
  .auth-card input {
    width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
    font-size: 15px; font-family: inherit; background: #fbfcfe; color: var(--ink); margin-bottom: 10px;
  }
  .auth-card input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
  .auth-card .btn { width: 100%; padding: 11px; margin-top: 4px; }
  .auth-err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 2px 0 4px; }
  .auth-tip { font-size: 12px; color: #94a3b8; margin-top: 12px; line-height: 1.5; }
  .auth-row { display: flex; gap: 8px; }
  .auth-row .btn { flex: 1; }

  /* 异常标记 */
  .ab-badge { font-size: 12px; font-weight: 600; border-radius: 6px; padding: 1px 8px; white-space: nowrap; }
  .ab-cleared { background: #d1fae5; color: #047857; }
  .ab-suspected { background: #fef3c7; color: #b45309; }
  .ab-confirmed { background: #fee2e2; color: #dc2626; }
  .ab-pending { background: #f1f5f9; color: #64748b; }
  .ab-desc { color: #b45309; font-size: 13px; }
  .ab-note { color: var(--ink2); font-size: 12.5px; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
  .ab-check { display: flex; align-items: center; gap: 8px; padding: 9px 11px; background: #fbfcfe; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
  .ab-check input { width: 16px; height: 16px; accent-color: #ef4444; cursor: pointer; }
  .ab-check span { font-size: 14px; }
  #abBlock { border-left: 3px solid #f59e0b; padding-left: 10px; margin-bottom: 13px; }
  .loc-line { font-size: 13px; color: var(--ink2); }
  .loc-line b { color: #0f766e; font-weight: 600; }

  /* 标签 */
  .tag-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .tag-grid > div { min-width: 0; }
  .tag-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
  .tag-chip { font-size: 12px; border-radius: 12px; padding: 1px 9px; background: #f1f5f9; color: #475569; white-space: nowrap; }
  .tc-same { background: #e0f2fe; color: #0369a1; }
  .tc-diff { background: #fae8ff; color: #a21caf; }
  .tc-known { background: #ecfdf5; color: #047857; }
  .tc-unknown { background: #f1f5f9; color: #64748b; }
  .tc-normal { background: #f1f5f9; color: #475569; }
  .tc-happy { background: #d1fae5; color: #047857; }
  .tc-awkward { background: #fef3c7; color: #b45309; }
  .tc-quarrel { background: #fee2e2; color: #dc2626; }
  .tc-timemis { background: #ffedd5; color: #c2410c; }
  .tc-listen { background: #e0e7ff; color: #4338ca; }

  /* 筛选栏 */
  .filter-bar { padding: 14px 16px 10px; margin-top: 14px; }
  .filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; align-items: end; }
  .filter-grid label { display: block; font-size: 11.5px; color: var(--ink2); font-weight: 600; margin-bottom: 3px; }
  .filter-grid input, .filter-grid select {
    width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px;
    font-size: 13px; font-family: inherit; background: #fbfcfe; color: var(--ink);
  }
  .filter-grid .kw { grid-column: 1 / -1; }
  .filter-info { font-size: 12.5px; color: var(--ink2); margin-top: 10px; }

  @media (max-width: 560px) {
    .time-pair { grid-template-columns: 1fr; }
    .tag-grid { grid-template-columns: 1fr; }
    .stat .v { font-size: 18px; }
    .top-actions { margin-left: 0; }
  }
  /* 模块导航（模块数 >= 2 时自动显示，由 TT.renderNav 控制） */
  .mod-nav { display: none; gap: 6px; padding: 10px 16px 0; max-width: 1100px; margin: 0 auto; }
  .mod-nav .mod-tab { border: 1px solid var(--line); background: var(--card); border-radius: 8px;
    padding: 6px 14px; font-size: 13px; cursor: pointer; color: var(--ink2); font-family: inherit; }
  .mod-nav .mod-tab.active { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; font-weight: 600; }
