/* ===== LoanGuard Design System ===== */
/* 基于 ResourceHub 极简克制风格 · Notion/Linear 美学 */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f5;
  --bg-hover: #f5f5f5;
  --bg-active: #e9ecef;
  --border-primary: #e5e7eb;
  --border-secondary: #f0f0f0;
  --border-focus: #d1d5db;
  --text-primary: #1a1a1a;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --text-inverse: #ffffff;
  --accent: #B8A9F0;
  --accent-light: #F0ECFF;
  --success: #7DD3B8;
  --success-light: #E8F8F2;
  --warning: #FFB97D;
  --warning-light: #FFF3E8;
  --danger: #FF9B9B;
  --danger-light: #FFEBEB;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 1px 3px rgba(0,0,0,.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.1);
  --sidebar-width: 220px;
  --sidebar-collapsed: 80px;
  --topbar-height: 48px;
  --radius: 6px;
  --radius-md: 8px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --transition: 150ms ease;
  --transition-slow: 250ms ease;
}

[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #222222;
  --bg-tertiary: #2a2a2a;
  --bg-hover: #2e2e2e;
  --bg-active: #363636;
  --border-primary: #333333;
  --border-secondary: #2a2a2a;
  --border-focus: #444444;
  --text-primary: #e5e5e5;
  --text-secondary: #9ca3af;
  --text-tertiary: #6b7280;
  --text-inverse: #1a1a1a;
  --accent: #CFC4FF;
  --accent-light: #2a2a2a;
  --success: #8EEDCE;
  --success-light: #0a2e1f;
  --warning: #FFCB9E;
  --warning-light: #2a2008;
  --danger: #FFB5B5;
  --danger-light: #2a1010;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
  --shadow-md: 0 1px 3px rgba(0,0,0,.3);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
body { font-family: var(--font-sans); background: var(--bg-secondary); color: var(--text-primary); line-height: 1.6; overflow: hidden; height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }

.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar { width: var(--sidebar-width); min-width: var(--sidebar-width); background: var(--bg-primary); border-right: 1px solid var(--border-primary); display: flex; flex-direction: column; transition: width var(--transition-slow), min-width var(--transition-slow); overflow: hidden; z-index: 20; }
.sidebar.collapsed { width: var(--sidebar-collapsed); min-width: var(--sidebar-collapsed); }
.sidebar-header { padding: 16px 14px 8px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.sidebar-logo { font-size: 15px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; overflow: hidden; }
.sidebar-toggle { margin-left: auto; padding: 4px; color: var(--text-secondary); border-radius: 4px; flex-shrink: 0; cursor: pointer; }
.sidebar-toggle:hover { background: var(--bg-hover); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 8px; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-primary); border-radius: 4px; }

.nav-section-title { font-size: 11px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .8px; padding: 12px 8px 4px; white-space: nowrap; overflow: hidden; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius); color: var(--text-secondary); font-size: 13px; cursor: pointer; transition: all var(--transition); white-space: nowrap; overflow: hidden; position: relative; text-decoration: none; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-light); color: var(--text-primary); font-weight: 500; }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 16px; background: var(--accent); border-radius: 0 2px 2px 0; }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { font-size: 11px; color: var(--text-tertiary); background: var(--bg-tertiary); padding: 1px 6px; border-radius: 10px; flex-shrink: 0; }

.sidebar-footer { border-top: 1px solid var(--border-primary); padding: 8px; flex-shrink: 0; }
.footer-btn { padding: 6px 8px; border-radius: var(--radius); color: var(--text-secondary); font-size: 12px; display: flex; align-items: center; gap: 6px; transition: all var(--transition); white-space: nowrap; overflow: hidden; width: 100%; }
.footer-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Bottom Nav (mobile only) - 默认隐藏 */
.bottom-nav { display: none; }

/* ActionSheet (mobile only) - 默认隐藏 */
.sheet-overlay { display: none; }
.action-sheet { display: none; }

.theme-toggle { width: 36px; height: 20px; background: var(--bg-tertiary); border: 1px solid var(--border-primary); border-radius: 10px; position: relative; cursor: pointer; transition: background var(--transition); flex-shrink: 0; }
.theme-toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; background: var(--text-secondary); border-radius: 50%; transition: transform var(--transition); }
[data-theme="dark"] .theme-toggle::after { transform: translateX(16px); }

/* Main content */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; max-width: 100%; }
.topbar { height: var(--topbar-height); background: var(--bg-primary); border-bottom: 1px solid var(--border-primary); display: flex; align-items: center; padding: 0 24px; gap: 12px; flex-shrink: 0; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-secondary); }
.breadcrumb-sep { color: var(--text-tertiary); }
.breadcrumb-current { color: var(--text-primary); font-weight: 500; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.page-content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 24px; min-width: 0; }
.page-content::-webkit-scrollbar { width: 6px; }
.page-content::-webkit-scrollbar-thumb { background: var(--border-primary); border-radius: 6px; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 600; color: var(--text-primary); }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* Stat Cards */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; min-width: 0; width: 100%; }
.stat-card { background: var(--bg-primary); border: 1px solid var(--border-primary); border-radius: 8px; padding: 14px; transition: box-shadow var(--transition); min-width: 0; max-width: 100%; overflow: hidden; word-break: break-word; }
.stat-card * { min-width: 0; }
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card .mobile-only { display: none; }
.stat-card .desktop-only { display: block; }
.stat-label { font-size: 12px; color: var(--text-tertiary); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }
.stat-value.danger { color: var(--danger); }
.stat-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.stat-sub.success { color: var(--success); }
.stat-sub.warning { color: var(--warning); }
.stat-sub.danger { color: var(--danger); }

/* Progress Bar */
.progress-bar { height: 6px; background: var(--bg-tertiary); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.progress-fill { height: 100%; border-radius: 3px; transition: width var(--transition-slow); }
.progress-fill.green { background: var(--success); }
.progress-fill.yellow { background: var(--warning); }
.progress-fill.red { background: var(--danger); }

/* Cards */
.card { background: var(--bg-primary); border: 1px solid var(--border-primary); border-radius: var(--radius-md); overflow: hidden; }
.card-header { padding: 14px 16px 10px; border-bottom: 1px solid var(--border-secondary); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 14px 16px; }
.card-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border-secondary); }
.card-row:last-child { border-bottom: none; }
.card-row-label { font-size: 13px; color: var(--text-secondary); }
.card-row-value { font-size: 13px; font-weight: 500; color: var(--text-primary); }

/* Table */
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-view { width: 100%; border-collapse: collapse; border: 1px solid var(--border-primary); border-radius: var(--radius-md); overflow: hidden; }
.table-view th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .5px; padding: 8px 14px; background: var(--bg-secondary); border-bottom: 1px solid var(--border-primary); white-space: nowrap; }
.table-view td { padding: 10px 14px; font-size: 13px; border-bottom: 1px solid var(--border-secondary); color: var(--text-primary); }
.table-view tr:last-child td { border-bottom: none; }
.table-view tr:hover td { background: var(--bg-hover); }
.table-center th, .table-center td { text-align: center; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; border-radius: var(--radius); font-size: 13px; font-weight: 500; transition: all var(--transition); border: 1px solid transparent; white-space: nowrap; cursor: pointer; }
.btn-primary { border-color: var(--text-primary); color: var(--text-primary); background: transparent; }
.btn-primary:hover { background: var(--text-primary); color: var(--bg-primary); }
.btn-success { border-color: var(--success); color: var(--success); }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-ghost { color: var(--text-secondary); border: 1px solid var(--border-primary); }
.btn-ghost:hover { border-color: var(--border-focus); color: var(--text-primary); }
.btn-danger { color: var(--danger); border: 1px solid #fecaca; }
.btn-danger:hover { background: var(--danger-light); border-color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 8px 20px; font-size: 14px; }
.btn-icon { padding: 6px; color: var(--text-secondary); border-radius: var(--radius); border: 1px solid transparent; }
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Form */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); margin-bottom: 5px; }
.form-input { width: 100%; padding: 8px 12px; background: var(--bg-secondary); border: 1px solid var(--border-secondary); border-radius: var(--radius-md); color: var(--text-primary); font-size: 13px; outline: none; transition: border-color var(--transition); }
.form-input::placeholder { color: var(--text-tertiary); }
.form-input:focus { border-color: var(--border-focus); }
.form-select { width: 100%; padding: 8px 12px; background: var(--bg-secondary); border: 1px solid var(--border-secondary); border-radius: var(--radius-md); color: var(--text-primary); font-size: 13px; outline: none; appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.form-textarea { width: 100%; padding: 8px 12px; background: var(--bg-secondary); border: 1px solid var(--border-secondary); border-radius: var(--radius-md); color: var(--text-primary); font-size: 13px; outline: none; resize: vertical; min-height: 60px; }
.form-textarea:focus { border-color: var(--border-focus); }

/* Category Grid */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; margin-bottom: 14px; }
.category-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border: 1px solid var(--border-primary); border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition); font-size: 12px; color: var(--text-secondary); }
.category-item:hover { border-color: var(--border-focus); color: var(--text-primary); }
.category-item.active { border-color: var(--accent); background: var(--accent-light); color: var(--text-primary); font-weight: 500; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-default { background: var(--bg-tertiary); color: var(--text-secondary); }

/* Alert */
.alert { padding: 10px 14px; border-radius: var(--radius-md); font-size: 13px; margin-bottom: 14px; border: 1px solid; display: flex; align-items: center; gap: 8px; }
.alert-warning { background: var(--warning-light); border-color: var(--warning); color: var(--warning); }
.alert-success { background: var(--success-light); border-color: var(--success); color: var(--success); }
.alert-danger { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-tertiary); }
.empty-icon { margin-bottom: 12px; opacity: .5; }
.empty-text { font-size: 13px; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* Chart container */
.chart-container { position: relative; height: 280px; }

/* Quick Actions Grid */
.actions-grid { display: flex; flex-wrap: wrap; gap: 8px; }

/* List Items */
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-secondary); }
.list-item:last-child { border-bottom: none; }
.list-item-main { flex: 1; min-width: 0; }
.list-item-title { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.list-item-sub { font-size: 12px; color: var(--text-tertiary); }
.list-item-value { font-size: 13px; font-weight: 600; white-space: nowrap; }
.list-item-value.red { color: var(--danger); }
.list-item-value.green { color: var(--success); }

/* Help / Tooltip */
.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.help-btn:hover { color: var(--accent); }
.help-btn:active { opacity: 0.7; }

.tip-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}
.tip-popup {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 48px);
  max-width: 360px;
  max-height: 70vh;
  background: var(--bg-primary);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  z-index: 1001;
  overflow: hidden;
  animation: tipIn 0.25s ease;
}
@keyframes tipIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.tip-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-primary);
}
.tip-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: var(--bg-secondary);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.tip-close:hover { background: var(--bg-active); color: var(--text-primary); }
.tip-body {
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  overflow-y: auto;
  max-height: calc(70vh - 56px);
  white-space: pre-line;
}

/* Two column grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); transition: transform var(--transition-slow); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { width: var(--sidebar-width); min-width: var(--sidebar-width); }
  .mobile-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 40; display: none; }
  .mobile-overlay.show { display: block; }
  .app-layout { min-width: 0; }
  .main-content { min-width: 0; }
  .page-content { padding: 16px; padding-bottom: 8px; min-width: 0; max-width: 100%; overflow-x: hidden; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; width: 100%; }
  .stat-card-full-mobile { grid-column: span 2; }
  .stat-card-full-mobile .stat-value { font-size: 28px; }
  .stat-card-full-mobile .stat-label { font-size: 13px; }
  .stat-card { min-width: 0; max-width: 100%; overflow: hidden; }

  /* 健康卡片头部：移动端换行 */
  .health-header { gap: 8px !important; }
  .health-title { width: 100%; order: 1; }
  .health-amount { width: 100%; order: 2; padding-left: 48px; }
  .card { min-width: 0; max-width: 100%; overflow: hidden; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }

  /* 移动端卡片信息降级：只展示关键摘要，避免内容被裁剪 */
  .stat-card .mobile-only { display: block; }
  .stat-card .desktop-only { display: none; }
  .stat-card .mobile-ring { width: 56px; height: 56px; }
  .stat-card .mobile-ring svg { width: 56px; height: 56px; }
  .stat-card .mobile-ring .ring-value { font-size: 14px; }
  .stat-card .mobile-ring .ring-label { font-size: 9px; }
  .stat-card .mobile-amount { font-size: 18px; }
  .stat-card .mobile-sub { font-size: 11px; margin-top: 4px; }
  .stat-card .mobile-table-compact { display: flex; flex-direction: column; gap: 6px; }
  .stat-card .mobile-summary-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-secondary); }
  .stat-card .mobile-summary-row .value { color: var(--text-primary); font-weight: 600; }
  .stat-card .mobile-mini-progress { height: 4px; border-radius: 2px; overflow: hidden; background: var(--bg-tertiary); margin-top: 6px; }
  .stat-card .mobile-mini-fill { height: 100%; border-radius: 2px; }

  /* 隐藏左上角汉堡按钮，改用底部导航栏 */
  .mobile-menu-btn { display: none !important; }

  /* 底部导航栏：移动端显示 */
  .bottom-nav {
    display: flex;
    flex-shrink: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg-primary);
    border-top: 1px solid var(--border-primary);
    z-index: 30;
  }
  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 0;
    color: var(--text-tertiary);
    font-size: 11px;
    line-height: 1.2;
    transition: color var(--transition);
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    position: relative;
  }
  .bottom-nav-item:active { color: var(--text-primary); }
  .bottom-nav-item.active { color: var(--accent); font-weight: 600; }
  .bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    width: 24px;
    height: 2px;
    background: var(--accent);
    border-radius: 0 0 2px 2px;
  }

  /* ActionSheet：从底部弹出，右手大拇指友好 */
  .sheet-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 60;
    animation: fadeIn 0.2s ease;
  }
  .action-sheet {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    border-radius: 16px 16px 0 0;
    padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    z-index: 61;
    animation: sheetUp 0.25s ease;
    box-shadow: 0 -4px 16px rgba(0,0,0,.15);
  }
  .sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border-primary);
    border-radius: 2px;
    margin: 4px auto 12px;
  }
  .sheet-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 16px;
  }
  .sheet-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  .sheet-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 8px;
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12px;
    text-decoration: none;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
  }
  .sheet-item:active {
    background: var(--bg-active);
    transform: scale(0.96);
  }
  .sheet-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
  }
  .sheet-label { text-align: center; }
}
@media (min-width: 769px) {
  .mobile-menu-btn { display: none !important; }
  .mobile-overlay { display: none !important; }
  .bottom-nav { display: none !important; }
  .sheet-overlay { display: none !important; }
  .action-sheet { display: none !important; }
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-primary); border-radius: 6px; }

/* ===== Animations & Micro-interactions ===== */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.02); } }

.page-content { animation: fadeIn 0.2s ease; }
.card { animation: fadeInUp 0.25s ease; transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease; border-radius: 10px; }
.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.stat-card { animation: fadeInUp 0.2s ease; transition: all 0.2s ease; border-radius: 10px; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.stat-value { transition: color 0.3s ease; }

.nav-item { transition: all 0.15s ease; border-radius: var(--radius); }
.nav-item:hover { transform: translateX(2px); }
.nav-item.active { animation: scaleIn 0.15s ease; }

.btn { transition: all 0.15s ease; border-radius: 8px; }
.btn:active { transform: scale(0.97); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.btn-success:hover { transform: translateY(-1px); }

.list-item { transition: all 0.15s ease; }
.list-item:hover { background: var(--bg-hover); padding-left: 4px; border-radius: var(--radius); }

.table-view td { transition: background 0.1s ease; }
.table-view tr { transition: background 0.1s ease; }

.badge { transition: all 0.2s ease; border-radius: 8px; }
.badge:hover { transform: scale(1.05); }

.category-item { border-radius: 10px; transition: all 0.15s ease; }
.category-item:hover { transform: translateY(-2px); box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.category-item.active { transform: scale(1.03); }

.form-input, .form-select, .form-textarea { border-radius: 8px; transition: all 0.15s ease; }
.form-input:focus, .form-select:focus, .form-textarea:focus { box-shadow: 0 0 0 3px rgba(55,65,81,.08); }

.progress-fill { transition: width 0.6s cubic-bezier(0.4,0,0.2,1); }
.stat-card .progress-bar { animation: fadeIn 0.5s ease 0.3s both; }

.alert { border-radius: 10px; animation: fadeInUp 0.2s ease; }
.empty-state { animation: fadeIn 0.3s ease; }
.modal { border-radius: 12px; animation: fadeInUp 0.2s ease; }

.sidebar { transition: width 0.25s ease, min-width 0.25s ease, transform 0.25s ease; }
.sidebar .nav-item { border-radius: 8px; }

.card-header { border-radius: 10px 10px 0 0; }
.card-body { animation: fadeIn 0.15s ease 0.1s both; }

/* Category icon colors */
.cat-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.cat-icon i { width: 18px; height: 18px; }
.cat-餐饮 { background: #fef3c7; color: #f59e0b; }
.cat-交通 { background: #dbeafe; color: #3b82f6; }
.cat-购物 { background: #fce7f3; color: #ec4899; }
.cat-娱乐 { background: #ede9fe; color: #8b5cf6; }
.cat-医疗 { background: #fee2e2; color: #ef4444; }
.cat-人情 { background: #fce7f3; color: #f472b6; }
.cat-通讯 { background: #d1fae5; color: #10b981; }
.cat-学习 { background: #e0e7ff; color: #6366f1; }
.cat-日用 { background: #f3f4f6; color: #6b7280; }
.cat-其他 { background: #f1f5f9; color: #94a3b8; }

[data-theme="dark"] .cat-餐饮 { background: #422006; color: #fbbf24; }
[data-theme="dark"] .cat-交通 { background: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] .cat-购物 { background: #500724; color: #f472b6; }
[data-theme="dark"] .cat-娱乐 { background: #2e1065; color: #a78bfa; }
[data-theme="dark"] .cat-医疗 { background: #450a0a; color: #f87171; }
[data-theme="dark"] .cat-人情 { background: #500724; color: #f9a8d4; }
[data-theme="dark"] .cat-通讯 { background: #052e16; color: #34d399; }
[data-theme="dark"] .cat-学习 { background: #1e1b4b; color: #818cf8; }
[data-theme="dark"] .cat-日用 { background: #1f2937; color: #9ca3af; }
[data-theme="dark"] .cat-其他 { background: #1e293b; color: #94a3b8; }

/* ===== Skeleton Loading ===== */
.skeleton { background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%); background-size: 200% 100%; animation: skeleton-shimmer 1.5s ease-in-out infinite; border-radius: var(--radius); }
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { height: 200px; border-radius: 10px; }
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-circle { width: 60px; height: 60px; border-radius: 50%; }

/* ===== Ring Progress ===== */
.ring-progress { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.ring-progress svg { transform: rotate(-90deg); }
.ring-progress .ring-bg { fill: none; stroke: var(--bg-tertiary); }
.ring-progress .ring-fill { fill: none; stroke-linecap: round; transition: stroke-dashoffset 0.8s cubic-bezier(0.4,0,0.2,1); }
.ring-progress .ring-text { position: absolute; text-align: center; }
.ring-progress .ring-value { font-size: 16px; font-weight: 700; color: var(--text-primary); display: block; }
.ring-progress .ring-label { font-size: 10px; color: var(--text-tertiary); display: block; }

/* ===== Collapsible Section ===== */
.collapsible-header { display: flex; align-items: center; gap: 4px; cursor: pointer; padding: 6px 0; color: var(--text-tertiary); font-size: 11px; transition: color var(--transition); user-select: none; -webkit-tap-highlight-color: transparent; }
.collapsible-header:hover { color: var(--text-secondary); }
.collapsible-header .chevron { transition: transform 0.2s ease; }
.collapsible-header .chevron.open { transform: rotate(90deg); }
.collapsible-body { overflow: hidden; transition: max-height 0.3s ease, opacity 0.2s ease; }
.collapsible-body.collapsed { max-height: 0; opacity: 0; }
.collapsible-body.expanded { max-height: 800px; opacity: 1; }

/* ===== Number Scroll Animation ===== */
.num-scroll { display: inline-block; overflow: hidden; height: 1em; line-height: 1; }
.num-scroll-inner { display: flex; flex-direction: column; transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
.num-scroll-digit { height: 1em; display: flex; align-items: center; justify-content: center; }

/* ===== Pull to Refresh ===== */
.pull-indicator { text-align: center; padding: 8px; font-size: 12px; color: var(--text-tertiary); transition: all 0.3s ease; overflow: hidden; max-height: 0; }
.pull-indicator.active { max-height: 40px; }
.pull-indicator .spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border-primary); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Health Card Data Grid ===== */
.health-data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; font-size: 12px; min-width: 0; width: 100%; overflow: hidden; }
.health-data-item { }
.health-data-label { color: var(--text-tertiary); margin-bottom: 1px; }
.health-data-value { font-weight: 600; }

/* ===== Icon with colored background ===== */
.icon-badge { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; min-width: 0; }
.icon-badge.success { background: var(--success-light); color: var(--success); }
.icon-badge.warning { background: var(--warning-light); color: var(--warning); }
.icon-badge.danger { background: var(--danger-light); color: var(--danger); }
.icon-badge.info { background: #E8F4FF; color: #8DC8FF; }
.icon-badge.muted { background: var(--bg-tertiary); color: var(--text-tertiary); }
