/* =========================================================
   MiniLedger — 苹果简洁风格
   字体 / 配色 / 圆角 / 阴影 均按需求定制
   ========================================================= */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;

  --bg: #F5F5F7;
  --card: #FFFFFF;
  --text: #1D1D1F;
  --text-2: #6E6E73;
  --text-3: #AEAEB2;
  --border: #E5E5EA;

  --primary: #007AFF;
  --primary-soft: #EAF3FF;
  --success: #34C759;
  --success-soft: #E8F9ED;
  --warning: #FF9500;
  --warning-soft: #FFF4E5;
  --danger: #FF3B30;
  --danger-soft: #FFEBEA;

  --radius-card: 16px;
  --radius-input: 12px;
  --radius-btn: 9999px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.05);
  --sidebar-w: 220px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }

/* ---------- 布局 ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column;
  padding: 20px 12px;
  overflow-y: auto;
  z-index: 40;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 12px 20px;
  font-weight: 700; font-size: 17px; letter-spacing: -0.3px;
}
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #007AFF, #4DA3FF);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px; flex: none;
}
.nav-group-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-3); padding: 14px 12px 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--text); font-weight: 500; margin-bottom: 2px;
  transition: background 0.15s;
}
.nav-item:hover { background: #F2F2F7; }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 24px 28px 40px;
  max-width: 1200px;
  width: 100%;
}

.topbar {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 12px; margin-bottom: 22px;
}
.topbar .user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px; background: var(--card);
  border-radius: var(--radius-btn); box-shadow: var(--shadow-card);
  font-weight: 500;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #5AC8FA, #007AFF);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); padding: 20px 22px;
}
.card + .card { margin-top: 20px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.card-sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }

/* 统计卡 */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.stat-card {
  background: var(--card); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); padding: 18px 20px;
}
.stat-label { font-size: 13px; color: var(--text-2); }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; margin-top: 6px; }
.stat-value.up { color: var(--danger); }
.stat-value.down { color: var(--success); }
.stat-foot { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius-btn); border: none; cursor: pointer;
  padding: 9px 18px; font-size: 14px; font-weight: 600;
  font-family: var(--font); transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn:active { opacity: 0.75; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-ghost { background: #F2F2F7; color: var(--text); }
.btn-outline { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 16px; }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.label .req { color: var(--danger); }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-input);
  border: 1px solid var(--border); background: #fff; font-size: 14px;
  font-family: var(--font); color: var(--text); outline: none;
  transition: border 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15); }
.input[disabled], .input[readonly] { background: #F2F2F7; color: var(--text-2); }
textarea.input { resize: vertical; min-height: 76px; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table thead th {
  text-align: left; padding: 10px 12px; font-size: 12px; font-weight: 600;
  color: var(--text-2); background: #F7F7FA; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody td { padding: 12px; border-bottom: 1px solid #F0F0F2; vertical-align: middle; }
.table tbody tr:hover { background: #FAFAFC; }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .muted { color: var(--text-2); }

/* ---------- 状态标签 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--radius-btn);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-blue   { background: var(--primary-soft); color: var(--primary); }
.badge-green  { background: var(--success-soft); color: var(--success); }
.badge-orange { background: var(--warning-soft); color: var(--warning); }
.badge-red    { background: var(--danger-soft); color: var(--danger); }
.badge-gray   { background: #F2F2F7; color: var(--text-2); }

/* ---------- 提示 / 闪存消息 ---------- */
.alert { border-radius: 12px; padding: 12px 16px; font-size: 14px; margin-bottom: 16px; }
.alert-success { background: var(--success-soft); color: #1c7c36; }
.alert-error { background: var(--danger-soft); color: #b3261e; }

/* ---------- 筛选栏 ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  margin-bottom: 16px;
}
.filter-bar .input, .filter-bar select.input { width: auto; min-width: 140px; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }

/* ---------- 分页 ---------- */
.pagination { display: flex; gap: 6px; margin-top: 18px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 7px 13px; border-radius: 10px; background: var(--card);
  box-shadow: var(--shadow-card); font-size: 13px; color: var(--text);
}
.pagination .active { background: var(--primary); color: #fff; }
.pagination .disabled { opacity: 0.4; }

/* ---------- 详情描述 ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 24px; }
.detail-item .k { font-size: 12px; color: var(--text-2); }
.detail-item .v { font-size: 14px; font-weight: 500; margin-top: 2px; }

/* ---------- 响应式 ---------- */
.mobile-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border); z-index: 50;
  justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.mobile-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; color: var(--text-2); padding: 4px 6px; flex: 1;
}
.mobile-nav a svg { width: 22px; height: 22px; }
.mobile-nav a.active { color: var(--primary); }

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 18px 16px 90px; }
  .mobile-nav { display: flex; }
  .topbar { justify-content: space-between; }
  .detail-grid { grid-template-columns: 1fr; }
}
