[hidden] { display: none !important; }
* { box-sizing: border-box; }

:root {
  --navy: #16263d;
  --navy-soft: #1e3350;
  --ink: #1b2b41;
  --muted: #7c8a9e;
  --line: #e2e8f0;
  --bg: #f2f5f9;
  --gold: #c9a227;
  --blue: #1f4e79;
  --green: #0f7b5f;
  --red: #c0392b;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

/* 布局与导航 */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px;
  flex-shrink: 0;
  background: var(--navy);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}
.brand { font-size: 18px; font-weight: 600; color: #fff; padding: 0 10px 26px; letter-spacing: .5px; }
.tag {
  font-size: 11px;
  color: #f0d178;
  border: 1px solid rgba(201, 162, 39, .5);
  background: rgba(201, 162, 39, .12);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: 2px;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  position: relative;
  padding: 11px 12px;
  border-radius: 8px;
  color: #b9c7d9;
  text-decoration: none;
  font-size: 14px;
}
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.active { background: rgba(201, 162, 39, .14); color: #e8c65c; font-weight: 500; }
.nav a.active::before {
  content: "";
  position: absolute;
  left: 0; top: 9px; bottom: 9px;
  width: 3px;
  background: var(--gold);
  border-radius: 2px;
}
.sidebar-foot { margin-top: auto; font-size: 11px; color: #6f829c; padding: 0 10px; letter-spacing: .5px; }
.main { flex: 1; min-width: 0; }
.topbar {
  height: 66px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--navy); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.countdown { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.content { max-width: 1080px; padding: 30px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
h1 { font-size: 24px; margin: 0; color: var(--navy); letter-spacing: .3px; }
h2 { font-size: 15px; margin: 0; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 13px; margin: 6px 0 0; }

/* 通用控件 */
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #4b5b70; }
input, select, textarea {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  border: 1px solid #d5dde7;
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  outline: none;
  width: 100%;
  resize: vertical;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 78, 121, .09); }
button { cursor: pointer; font: inherit; }
.btn { border-radius: 8px; padding: 8px 15px; font-size: 13px; border: 1px solid transparent; }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: #173c5e; }
.btn-ghost { background: #fff; border-color: #d5dde7; color: #4b5b70; }
.btn-ghost:hover { background: #f4f7fa; }
.btn-mini { padding: 4px 10px; font-size: 12px; background: #fff; border-color: #d5dde7; color: #4b5b70; }
.btn-mini:hover { background: #f4f7fa; }
.btn-danger { color: var(--red); border-color: #f0c9c4; }
.btn-danger:hover { background: #fdf1ef; }
.btn-danger-solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger-solid:hover { background: #a32d20; }
.error { color: var(--red); font-size: 12px; margin: 0; }
.success { color: var(--green); font-size: 12px; margin: 0; background: #e8f5ee; border-radius: 6px; padding: 8px 10px; }
.check-line { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: #4b5b70; }
.check-line input { width: auto; margin: 0; }
.field-set { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.field-set legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
.field-label { font-size: 13px; color: #4b5b70; }
.hint { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.6; }
.hint-box { background: #eef4fa; border-left: 3px solid var(--blue); color: #4b5b70; font-size: 13px; padding: 12px 14px; border-radius: 6px; margin-bottom: 16px; }
.danger-box { background: #fdf3f1; border: 1px solid #f0c9c4; border-radius: 10px; padding: 20px; }
.danger-box p { font-size: 13px; color: #7a514c; line-height: 1.7; margin: 0 0 18px; }

/* 登录 */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--navy); }
.auth-card {
  max-width: 380px;
  width: 100%;
  background: #fff;
  border-top: 4px solid var(--gold);
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
}
.auth-card form { margin-top: 24px; display: flex; flex-direction: column; gap: 14px; }
.login-version { text-align: center; font-size: 11px; color: #a7b2c1; margin-top: 18px; letter-spacing: 1px; }

/* 仪表盘占位 */
.placeholder { background: #fff; border: 1px dashed #cfd8e3; border-radius: 12px; padding: 80px 20px; text-align: center; }
.placeholder-icon { width: 46px; height: 46px; border: 2px dashed #b9c6d6; border-radius: 12px; margin: 0 auto 18px; }
.placeholder-title { font-size: 18px; font-weight: 500; color: #4b5b70; }
.placeholder-note { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* 汇总条 */
.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.summary-item {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(22, 38, 61, .04);
}
.summary-item span { font-size: 12px; color: var(--muted); letter-spacing: .5px; }
.summary-item strong { font-size: 22px; font-weight: 600; }
.income { color: var(--green); }
.expense { color: var(--red); }
.transfer { color: var(--muted); }
.amount, .summary-item strong { font-family: "SF Mono", Consolas, Menlo, monospace; font-variant-numeric: tabular-nums; }

/* 账户分组 */
.group-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; overflow: hidden; box-shadow: 0 2px 8px rgba(22, 38, 61, .04); }
.group-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; background: #f5f8fb; border-bottom: 1px solid var(--line); }
.group-head h2 { color: var(--navy); }
.count { font-size: 11px; color: var(--muted); background: #e6edf4; border-radius: 10px; padding: 1px 7px; }
.group-body { padding: 4px 18px; }
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid #edf1f5; }
.account-row:last-child { border-bottom: 0; }
.account-main { min-width: 0; }
.account-name { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.type-pill { font-size: 11px; font-weight: 400; color: var(--blue); background: #eaf1f8; border-radius: 4px; padding: 2px 6px; }
.account-meta { font-size: 12px; color: var(--muted); margin-top: 5px; overflow-wrap: anywhere; }
.row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.empty { padding: 18px 0; font-size: 13px; color: #9aa6b5; }

/* 表格 */
.table-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(22, 38, 61, .04); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; background: #f5f8fb; padding: 12px 16px; color: #5b6b80; font-weight: 600; border-bottom: 1px solid var(--line); }
.data-table td { padding: 12px 16px; border-bottom: 1px solid #edf1f5; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fafcff; }
.muted-cell { color: var(--muted); }
.status { font-size: 11px; border-radius: 10px; padding: 2px 8px; }
.status.on { background: #e8f5ee; color: var(--green); }
.status.off { background: #f1f3f6; color: var(--muted); }
.tag-pill { display: inline-block; font-size: 11px; color: #8a6d12; background: #fbf4dd; border: 1px solid #f0e3b8; border-radius: 10px; padding: 2px 8px; margin: 0 4px 4px 0; }
.tag-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-option { font-size: 12px; background: #fff; border: 1px solid #d5dde7; color: #4b5b70; border-radius: 16px; padding: 5px 12px; }
.tag-option:hover { border-color: var(--blue); }
.tag-option.selected { background: var(--blue); border-color: var(--blue); color: #fff; }
.inline-create { display: flex; gap: 8px; }
.inline-create .btn { flex-shrink: 0; }
.transfer-box { background: #f2f7fb; border: 1px solid #d7e4f0; border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }

/* 弹窗 */
.modal-backdrop { position: fixed; inset: 0; background: rgba(13, 26, 43, .55); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10; }
.modal { width: 100%; max-width: 420px; background: #fff; border-radius: 14px; padding: 24px; max-height: 90vh; overflow: auto; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
.modal-wide { max-width: 480px; }
.modal h2 { color: var(--navy); }
.modal form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* 折叠导航 */
.nav-group { border-top: 1px solid rgba(255, 255, 255, .08); margin-top: 6px; padding-top: 6px; }
.nav-group > .nav-group-title {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  color: #b9c7d9;
  font-size: 14px;
  cursor: pointer;
}
.nav-group > .nav-group-title::-webkit-details-marker { display: none; }
.nav-group > .nav-group-title:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.chevron {
  width: 6px; height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .18s;
  opacity: .7;
}
.nav-group[open] > .nav-group-title .chevron { transform: rotate(45deg); }
.nav-group-items { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 4px 12px; }
.nav .nav-sub { padding: 7px 10px 7px 14px; font-size: 13px; color: #90a1b7; border-radius: 6px; }
.nav .nav-sub:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav .nav-sub.active { background: rgba(201, 162, 39, .14); color: #e8c65c; font-weight: 500; }
.nav .nav-sub.active::before { display: none; }

/* 账户概览 */
.account-overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.overview-item {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.overview-item span { font-size: 12px; color: var(--muted); }
.overview-item strong { font-size: 16px; color: var(--navy); }
.overview-item .amount { font-size: 22px; }

/* 设置面板 */
.settings-panel { flex: 1; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(22, 38, 61, .04); }
.settings-panel-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 18px; }
.settings-panel-head h2 { color: var(--navy); }
.section-toolbar { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.item-group + .item-group { margin-top: 22px; }
.form-card { display: flex; flex-direction: column; gap: 14px; max-width: 400px; }

@media (max-width: 860px) {
  .summary-strip { grid-template-columns: 1fr; }
  .account-overview { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sidebar { width: 150px; padding: 18px 10px; }
  .content { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
}
