/* 熵迹 - 全局样式 */
/* 细滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C9CDD4; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #A8ADB5; }
* { scrollbar-width: thin; scrollbar-color: #C9CDD4 transparent; }

* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #4A90B8;
  --primary-light: #6BB3D9;
  --primary-bg: #E8F4FC;
  --accent: #F59E0B;
  --danger: #EF4444;
  --success: #10B981;
  --text: #1F2937;
  --text2: #6B7280;
  --text3: #9CA3AF;
  --bg: #F4F8FB;
  --card: #FFFFFF;
  --border: #DCE6EF;
  --radius: 12px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  padding-bottom: 70px;
}
a { color: var(--primary); text-decoration: none; }

/* 顶部导航 */
.topbar {
  background: linear-gradient(135deg, #3A7CA5, #5B9BD5);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.topbar .logo { font-size: 18px; font-weight: 700; letter-spacing: 2px; }
.topbar .logo small { font-size: 11px; font-weight: 400; opacity: 0.8; margin-left: 6px; }
.topbar .page-title { font-size: 15px; font-weight: 600; }

/* 底部导航（手机端） */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  font-size: 10px;
  color: var(--text2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a .icon { font-size: 20px; }

/* 容器 */
.container { padding: 12px; max-width: 1200px; margin: 0 auto; }

/* 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 指标卡 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.stat-card .label { font-size: 12px; color: var(--text2); margin-bottom: 4px; }
.stat-card .value { font-size: 22px; font-weight: 700; color: var(--text); }
.stat-card .value small { font-size: 12px; font-weight: 400; color: var(--text3); }
.stat-card.primary { background: linear-gradient(135deg, #374151, #6B7280); }
.stat-card.primary .label, .stat-card.primary .value { color: #fff; }
.stat-card.accent { background: linear-gradient(135deg, #D97706, #F59E0B); }
.stat-card.accent .label, .stat-card.accent .value { color: #fff; }

/* 快捷按钮 */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.quick-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.quick-btn:active { transform: scale(0.96); background: var(--primary-bg); }
.quick-btn .icon { font-size: 28px; margin-bottom: 6px; }
.quick-btn .text { font-size: 13px; font-weight: 500; color: var(--text); }

/* 列表 */
.list-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.list-item:active { background: #F9FAFB; }
.list-item .main { flex: 1; min-width: 0; }
.list-item .title { font-size: 14px; font-weight: 600; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .sub { font-size: 12px; color: var(--text2); }
.list-item .amount { font-size: 16px; font-weight: 700; color: var(--primary); margin-left: 10px; white-space: nowrap; }
.list-item .amount.expense { color: var(--danger); }

/* 标签 */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  margin-right: 4px;
}
.tag-green { background: #52C41A; color: #fff; }
.tag-blue { background: #1890FF; color: #fff; }
.tag-orange { background: #FED7AA; color: #9A3412; }
.tag-purple { background: #E9D5FF; color: #6B21A8; }
.tag-gray { background: #F3F4F6; color: #4B5563; }
.tag-red { background: #EA6668; color: #fff; }
.tag-yellow { background: #FEF3C7; color: #92400E; }

/* 表格（电脑端） */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
th { background: #F1F5F9; padding: 10px 8px; text-align: center; font-weight: 600; color: var(--text2); white-space: nowrap; border-bottom: 2px solid var(--border); border-right: 1px solid var(--border); position: relative; user-select: none; }
th.sortable { cursor: pointer; }
th.sortable:hover { background: #E2E8F0; }
th:last-child { border-right: none; }
td { padding: 10px 8px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
td:last-child { border-right: none; }
tr:hover td { background: #F8FAFC; }
.num { text-align: center; font-variant-numeric: tabular-nums; }
/* 列宽拖拽手柄（默认可见细线，悬停/拖动高亮） */
th .col-resizer { position: absolute; right: 0; top: 0; width: 6px; height: 100%; cursor: col-resize; user-select: none; background: rgba(15,23,42,0.10); }
th .col-resizer:hover, th .col-resizer.active { background: rgba(37,99,235,0.4); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: #3A7CA5; }
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }

/* 筛选栏 */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-bar select, .filter-bar input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
}

/* 弹窗 */
.modal-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff;
  width: 100%;
  max-width: 500px;
  border-radius: 16px 16px 0 0;
  padding: 20px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
@media (min-width: 768px) { .modal-title { cursor: move; } }
.modal-close { font-size: 22px; color: var(--text3); cursor: pointer; background: none; border: none; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text2); margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary-light);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* 空状态 */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text3);
}
.empty .icon { font-size: 48px; margin-bottom: 10px; }

/* 进度条 */
.progress { height: 6px; background: #E5E7EB; border-radius: 3px; overflow: hidden; margin-top: 4px; }
.progress-bar { height: 100%; background: var(--primary-light); border-radius: 3px; transition: width 0.3s; }

/* 电脑端适配 */
@media (min-width: 768px) {
  body { padding-bottom: 0; }
  .bottom-nav { display: none; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-actions { grid-template-columns: repeat(4, 1fr); }
  .modal { border-radius: 16px; margin-bottom: auto; margin-top: 5vh; }
  .modal-mask { align-items: flex-start; }
  .topbar { padding: 14px 24px; }
  .container { padding: 20px; }
}

/* 侧边导航（电脑端） */
.sidebar { display: none; }
@media (min-width: 768px) {
  .layout { display: flex; min-height: 100vh; }
  .sidebar {
    display: block;
    width: 150px;
    background: #fff;
    border-right: 1px solid var(--border);
    padding: 16px 0;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    overflow-y: auto;
  }
  .sidebar .brand {
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
  }
  .sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    color: var(--text2);
    font-size: 14px;
    border-left: 3px solid transparent;
  }
  .sidebar a:hover { background: var(--primary-bg); color: var(--primary); }
  .sidebar a.active { background: var(--primary-bg); color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
  .sidebar .nav-group { padding: 10px 20px 2px; font-size: 14px; color: var(--text2); text-transform: none; letter-spacing: 0; font-weight: 700; }
  .main-content { margin-left: 150px; flex: 1; }
  .topbar { display: none; }
  #sidebar-resizer {
    display: none !important;
  }
  .sidebar-user { border-top: 1px solid var(--border); margin: 10px 12px 0; padding: 12px 8px 0; display: flex; align-items: center; justify-content: space-between; }
  .sidebar-user .name { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; }
  .sidebar-user .name small { font-size: 11px; color: var(--primary); font-weight: 400; }
  .sidebar-user .ops { display: flex; gap: 16px; margin-top: 0; }
  .sidebar-user .ops a { padding: 0; font-size: 12px; border: none; }
}

/* 初始密码提示条 */
.pw-tip { background: #FFFBEB; border-bottom: 1px solid #FDE68A; color: #92400E; font-size: 13px; padding: 8px 14px; text-align: center; }
.pw-tip a { color: #B45309; font-weight: 600; }

/* 标签页 */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; background: var(--card); padding: 4px; border-radius: 10px; border: 1px solid var(--border); }
.tab { flex: 1; padding: 10px; border: none; background: transparent; border-radius: 8px; font-size: 14px; cursor: pointer; color: var(--text2); transition: all 0.2s; }
.tab:hover { background: var(--bg); }
.tab.active { background: var(--primary); color: white; font-weight: 600; }


/* 关联链接 */
.link { color: #2563EB; cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }


/* 统计框 */
.stat-box { flex: 1; min-width: 150px; padding: 14px; border-radius: 12px; text-align: center; }
.photo-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; cursor: zoom-in; border: 1px solid var(--border); }
.stat-label { font-size: 12px; color: rgba(0,0,0,0.6); margin-bottom: 4px; }
.stat-value { font-size: 20px; font-weight: 700; }


/* 四色卡：红/黄/绿/灰 */
.stat-card-red    { background: #FEE2E2; border-left: 4px solid #EA6668; }
.stat-card-yellow { background: #FEF3C7; border-left: 4px solid #F59E0B; }
.stat-card-green  { background: #D1FAE5; border-left: 4px solid #10B981; }
.stat-card-gray   { background: #F3F4F6; border-left: 4px solid #9CA3AF; }

/* 表格统一宽度 1140px 居中 */
.table-1140 { width: 1140px; max-width: 100%; margin: 0 auto; }

/* 编辑按钮统一蓝色 */
.btn-edit { background: var(--primary); color: #fff; padding: 5px 12px; border-radius: 6px; font-size: 12px; border: none; cursor: pointer; }
.btn-edit:hover { background: #3A7CA5; }
