/* MDB 个人记录 · 样式 */
:root {
  --bg: #f5f7f5; --panel: #ffffff; --panel-2: #eef2ee;
  --border: #e0e6e0; --text: #1f2a24; --soft: #6b7a70; --faint: #9aa8a0;
  --green: #4a8b6a; --green-soft: #e6f2ea;
  --red: #c25050; --blue: #4a6f9b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 40, 30, .05), 0 10px 28px -18px rgba(20, 40, 30, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------------- 布局 ---------------- */
.app { display: grid; grid-template-columns: 208px 1fr; height: 100vh; overflow: hidden; }

.sidebar {
  background: var(--panel); border-right: 1px solid var(--border);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.brand-mark { font-size: 24px; }
.brand strong { display: block; font-size: 15px; }
.brand small { color: var(--faint); font-size: 11px; letter-spacing: .3px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--soft); text-decoration: none; font-size: 13.5px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.is-active { background: var(--green-soft); color: var(--green); font-weight: 600; }
.nav-ico { width: 16px; text-align: center; opacity: .9; }

.side-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.user { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--soft); flex: 1; min-width: 0; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none;
}
.ghost {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 10px; font-size: 12px; color: var(--soft);
}
.ghost:hover { color: var(--red); border-color: var(--red); }

.main { overflow-y: auto; padding: 22px 26px 48px; }

/* ---------------- 顶部 ---------------- */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.topbar h1 { margin: 0; font-size: 21px; letter-spacing: .2px; }
.topbar p { margin: 3px 0 0; font-size: 12.5px; color: var(--faint); }
.month-picker input {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel); outline: none;
}
.month-picker input:focus { border-color: var(--green); }

/* ---------------- 卡片 ---------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.card-label { display: block; font-size: 12px; color: var(--soft); margin-bottom: 6px; }
.card-value { font-size: 24px; font-weight: 700; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.card-value.income { color: var(--green); }
.card-value.expense { color: var(--red); }

/* ---------------- 面板 ---------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; }
.muted { font-size: 12px; color: var(--faint); }

/* ---------------- 图表（纯 CSS 柱状） ---------------- */
.chart { display: flex; flex-direction: column; gap: 8px; }
.chart-row { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 10px; }
.chart-label { font-size: 11.5px; color: var(--soft); text-align: right; font-variant-numeric: tabular-nums; }
.chart-bars { display: flex; flex-direction: column; gap: 3px; }
.bar { height: 9px; border-radius: 99px; background: var(--green); min-width: 2px; transition: width .3s; }
.bar.is-expense { background: var(--red); opacity: .75; }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bars-row { display: grid; grid-template-columns: 74px 1fr 80px; gap: 10px; align-items: center; }
.bars-name { font-size: 12.5px; color: var(--soft); }
.bars-track { background: var(--panel-2); border-radius: 99px; height: 10px; overflow: hidden; }
.bars-fill { height: 100%; background: var(--green); border-radius: 99px; }
.bars-val { font-size: 12px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------------- 属性 ---------------- */
.attrs { display: flex; flex-direction: column; gap: 12px; }
.attrs-lg { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.attrs-lg .attr { background: var(--panel-2); border-radius: 10px; padding: 11px 14px; }
.attr { }
.attr-head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.attr-name { font-weight: 600; }
.attr-lv { color: var(--faint); font-size: 11.5px; }
.attr-track { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.attr-fill { height: 100%; background: linear-gradient(90deg, #6fb894, #4a8b6a); border-radius: 99px; }

/* ---------------- 列表 ---------------- */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list li {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12.5px; padding: 8px 10px; background: var(--panel-2); border-radius: 9px;
}
.list .li-main { color: var(--text); }
.list .li-side { color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.empty { color: var(--faint); font-size: 12.5px; padding: 10px 0; }

/* ---------------- 表单 ---------------- */
.form-row {
  display: grid; grid-template-columns: repeat(5, 1fr) auto; gap: 8px; align-items: center;
}
.form-row input, .form-row select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel-2); outline: none; min-width: 0;
}
.form-row input:focus, .form-row select:focus { border-color: var(--green); background: var(--panel); }
.primary {
  background: var(--green); color: #fff; border: none; border-radius: 9px;
  padding: 9px 16px; font-weight: 600; white-space: nowrap;
}
.primary:hover { filter: brightness(1.07); }
.primary:disabled { opacity: .6; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; margin-top: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 600; color: var(--soft); font-size: 12px;
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 9px 10px; border-bottom: 1px solid var(--panel-2); }
.table tbody tr:hover { background: var(--panel-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .money { color: var(--green); font-weight: 600; }
.table .money.out { color: var(--red); }
.row-actions { white-space: nowrap; text-align: right; }
.icon-btn {
  background: transparent; border: none; color: var(--faint);
  padding: 2px 6px; border-radius: 6px; font-size: 13px;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn.del:hover { color: var(--red); }

/* ---------------- 登录 ---------------- */
.login-body {
  display: grid; place-items: center; min-height: 100vh; padding: 24px;
  background:
    radial-gradient(900px 480px at 15% -10%, rgba(74, 139, 106, .16), transparent 60%),
    radial-gradient(700px 420px at 105% 110%, rgba(74, 111, 155, .12), transparent 55%),
    var(--bg);
}
.login-wrap { width: min(370px, 100%); }
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px;
  padding: 32px 28px 24px; box-shadow: var(--shadow), 0 22px 60px -32px rgba(20, 40, 30, .45);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand .mark { font-size: 38px; }
.login-brand h1 { margin: 8px 0 3px; font-size: 19px; }
.login-brand p { margin: 0; font-size: 12px; color: var(--faint); letter-spacing: .4px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12px; font-weight: 600; color: var(--soft); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel-2); outline: none;
}
.field input:focus { border-color: var(--green); background: var(--panel); box-shadow: 0 0 0 3px var(--green-soft); }
.login-card .primary { width: 100%; padding: 12px; letter-spacing: 2px; margin-top: 4px; }
.err {
  background: rgba(194, 80, 80, .1); border: 1px solid rgba(194, 80, 80, .25);
  color: var(--red); font-size: 12.5px; border-radius: 9px; padding: 8px 11px; margin: 0 0 12px;
}
.hint { text-align: center; font-size: 11.5px; color: var(--faint); margin: 18px 0 0; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .side-foot { margin: 0; border: none; padding: 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr 1fr; }
}
