:root {
  --primary: #2f6fed;
  --primary-dark: #2458c4;
  --primary-light: #eaf0fd;
  --navy: #16294d;
  --navy-2: #1e3563;
  --navy-3: #2a4a86;
  --bg: #f2f4f8;
  --card: #ffffff;
  --text: #1f2733;
  --text-2: #667085;
  --border: #e6e8ee;
  --red: #e5484d;
  --green: #2e9e5b;
  --orange: #f29900;
  --blue: #2f6fed;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
  --sidebar-w: 236px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}

.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; color: var(--text); }

/* ============ Logo ============ */
.logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f8cff 0%, #7c5cff 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79,140,255,.35);
}
.logo svg { width: 26px; height: 26px; }
.logo-lg { width: 66px; height: 66px; border-radius: 18px; }
.logo-lg svg { width: 42px; height: 42px; }

/* ============ 登录页（电脑版·左右分栏） ============ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(150deg, #e8f0fe 0%, #eef1fb 45%, #e9ecf8 100%);
}
.login-card {
  display: flex;
  width: 100%;
  max-width: 840px;
  min-height: 500px;
  background: #fff;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(22,41,77,.14);
}
.login-side {
  width: 320px;
  flex-shrink: 0;
  background: linear-gradient(160deg, #16294d 0%, #24437a 60%, #2a4a86 100%);
  color: #fff;
  padding: 46px 34px;
  display: flex;
  flex-direction: column;
}
.login-side h1 { font-size: 24px; margin: 20px 0 6px; letter-spacing: 1px; }
.login-slogan { font-size: 13px; color: rgba(255,255,255,.65); margin: 0 0 28px; }
.login-feats { list-style: none; margin: 0; padding: 0; flex: 1; }
.login-feats li {
  font-size: 14px; color: rgba(255,255,255,.85); padding: 10px 0;
  border-bottom: 1px dashed rgba(255,255,255,.16);
}
.login-tag {
  align-self: flex-start;
  font-size: 12px; color: rgba(255,255,255,.75);
  border: 1px solid rgba(255,255,255,.35); border-radius: 20px; padding: 4px 14px;
}
.login-main { flex: 1; padding: 46px 44px; display: flex; flex-direction: column; justify-content: center; }
.login-main h2 { font-size: 22px; margin: 0 0 4px; }
.login-welcome-sub { font-size: 13px; color: var(--text-2); margin: 0 0 24px; }
.login-hint { color: var(--text-2); font-size: 12px; margin: 18px 0 0; }

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-title { font-weight: 700; font-size: 17px; color: #fff; letter-spacing: .5px; }
.sidebar-user { font-size: 12px; color: rgba(255,255,255,.55); margin-top: 1px; }
.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-radius: 11px;
  color: rgba(255,255,255,.72);
  cursor: pointer;
  margin-bottom: 4px;
  font-size: 14px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background .15s, color .15s;
}
.sidebar-nav .nav-item .nav-icon { width: 20px; text-align: center; font-size: 17px; }
.sidebar-nav .nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav .nav-item.active {
  background: linear-gradient(135deg, #4f8cff, #6a5cff);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(79,140,255,.35);
}
.sidebar-logout {
  margin: 0 12px 16px;
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.8);
  border: none;
}
.sidebar-logout:hover { background: rgba(255,255,255,.14); color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-weight: 700; font-size: 18px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user { font-size: 13px; color: var(--text-2); }

.content { flex: 1; padding: 20px 24px; max-width: 1080px; width: 100%; margin: 0 auto; }

/* ============ 组件 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  transition: all .15s;
  background: #fff;
  color: var(--text);
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(47,111,237,.28); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { color: var(--red); border-color: rgba(229,72,77,.3); }
.btn-danger:hover { background: #fdecea; }
.btn-outline { border-color: var(--border); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.card-title { font-weight: 700; font-size: 15px; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; }
.card-title .link { font-size: 13px; color: var(--primary); font-weight: 500; cursor: pointer; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  background: #fafbfc;
  transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47,111,237,.12);
}
.field textarea { min-height: 70px; resize: vertical; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.stat-card .stat-label { font-size: 13px; color: var(--text-2); }
.stat-card .stat-value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.stat-card .stat-value.money { color: var(--green); }
.stat-card .stat-value.danger { color: var(--red); }
.stat-card .stat-value.accent { color: var(--primary); }
.stat-card .stat-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* 列表 */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; font-size: 15px; }
.list-sub { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-side { text-align: right; flex-shrink: 0; }
.list-amount { font-weight: 700; font-size: 15px; }
.list-actions { display: flex; gap: 6px; }

.tag { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.tag-green { background: #e6f6ec; color: var(--green); }
.tag-red { background: #fdecea; color: var(--red); }
.tag-orange { background: #fff4e0; color: var(--orange); }
.tag-blue { background: var(--primary-light); color: var(--primary); }
.tag-gray { background: #eef0f4; color: var(--text-2); }

/* 提醒 banner */
.banner {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}
.banner-red { background: #fdecea; color: #b71c1c; border: 1px solid #f8c9c9; }
.banner-orange { background: #fff4e0; color: #b25e00; border: 1px solid #f5dfb2; }
.banner .banner-icon { font-size: 22px; }

/* 空状态 */
.empty { text-align: center; color: var(--text-2); padding: 44px 16px; }
.empty .empty-icon { font-size: 46px; margin-bottom: 10px; }
.empty p { margin: 4px 0; }

/* 悬浮按钮 */
.fab {
  position: fixed;
  right: 26px;
  bottom: 28px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f8cff, #6a5cff);
  color: #fff;
  border: none;
  font-size: 26px;
  box-shadow: 0 8px 22px rgba(79,140,255,.45);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fab:hover { transform: scale(1.04); }

/* ============ 数据看板图表 ============ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.barchart { display: flex; align-items: flex-end; gap: 10px; padding-top: 10px; }
.bc-col { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.bc-val { font-size: 11px; color: var(--text-2); margin-bottom: 6px; white-space: nowrap; }
.bc-bar { width: 62%; max-width: 38px; background: linear-gradient(180deg, #6a9bff, #2f6fed); border-radius: 7px 7px 3px 3px; min-height: 2px; transition: height .35s ease; }
.bc-bar.orange { background: linear-gradient(180deg, #ffc04d, #f29900); }
.bc-label { font-size: 11px; color: var(--text-2); margin-top: 8px; white-space: nowrap; }

.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; border-radius: 50%; position: relative; flex-shrink: 0; }
.donut-hole {
  position: absolute; inset: 27%; background: #fff; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700; font-size: 20px; color: var(--text);
}
.donut-hole small { font-size: 11px; color: var(--text-2); font-weight: 400; }
.legend { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 140px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.legend-item .dot { width: 10px; height: 10px; border-radius: 3px; }
.legend-item b { margin-left: auto; color: var(--text); }

.hbar { margin-bottom: 14px; }
.hbar:last-child { margin-bottom: 0; }
.hbar-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.hbar-top b { color: var(--text); }
.hbar-track { height: 8px; background: #eef0f4; border-radius: 6px; overflow: hidden; }
.hbar-fill { height: 100%; background: linear-gradient(90deg, #6a9bff, #2f6fed); border-radius: 6px; transition: width .35s ease; }

.top-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.top-item:last-child { border-bottom: none; }
.top-rank {
  width: 26px; height: 26px; border-radius: 8px; background: #eef0f4; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.top-rank.top { background: linear-gradient(135deg, #ffb74d, #ff9800); color: #fff; }
.top-main { flex: 1; min-width: 0; }
.top-name { font-size: 14px; font-weight: 600; }
.top-side { text-align: right; flex-shrink: 0; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16,24,40,.5);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: #fff;
  width: 100%;
  max-width: 480px;
  border-radius: 16px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  animation: pop .2s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: .5; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 10px;
}
.modal-title { font-weight: 700; font-size: 17px; }
.modal-close { border: none; background: var(--bg); border-radius: 50%; width: 30px; height: 30px; font-size: 14px; color: var(--text-2); }
.modal-body { padding: 4px 20px 10px; overflow-y: auto; }
.modal-foot { padding: 12px 20px 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.modal-foot .btn { flex: 1; }

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(22,41,77,.94);
  color: #fff;
  padding: 11px 20px;
  border-radius: 11px;
  font-size: 14px;
  z-index: 100;
  max-width: 86%;
  text-align: center;
  animation: fadeIn .2s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast.success { background: rgba(46,158,91,.95); }
.toast.error { background: rgba(229,72,77,.95); }
@keyframes fadeIn { from { opacity: 0; transform: translate(-50%,-8px); } to { opacity: 1; transform: translate(-50%,0); } }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .login-card { max-width: 400px; min-height: 0; }
  .login-main { padding: 36px 28px; }
  .content { padding: 16px; }
  .fab { right: 18px; bottom: 22px; }
  .field-row { flex-direction: column; gap: 0; }
}
