* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --brand: #2563eb;
  --brand-dark: #1e4fd6;
  --brand-soft: #eff4ff;
  --brand-sky: #38bdf8;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f2f6fc;
  --card: #ffffff;
  --danger: #e04a3f;
  --warn: #d97706;
  --info: #2563eb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 34, 82, .08), 0 1px 2px rgba(15, 34, 82, .04);
  font-size: 14px;
}
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0b2a66 0%, #1d4ed8 52%, #3b82f6 100%);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 18px;
  padding: 34px 30px 26px;
  box-shadow: 0 18px 50px rgba(7, 24, 66, .35);
}
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, #4f8bff, #1d4ed8);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; flex: none;
}
.brand-logo.small { width: 36px; height: 36px; font-size: 18px; border-radius: 10px; }
.brand-name { font-size: 18px; font-weight: 700; }
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: #334155; margin-bottom: 6px; }
.field input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font-size: 14px; outline: none; transition: border .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.login-tip { margin-top: 16px; color: #94a3b8; font-size: 12px; line-height: 1.7; text-align: center; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.side-mask { display: none; }
.sidebar {
  width: 224px; background: linear-gradient(180deg, #0a1e3f 0%, #0c2550 100%); color: #c9d8f2; flex: none;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; gap: 10px; align-items: center; padding: 20px 18px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.side-title { font-weight: 700; font-size: 14px; color: #fff; }
.side-env { font-size: 10px; color: #7e9ad1; letter-spacing: 1px; margin-top: 2px; }
.nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 4px;
  border-radius: 10px; color: #aec4ea; cursor: pointer; font-size: 14px;
}
.nav-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, #3b82f6, #2563eb); color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .35);
}
.nav-ic {
  width: 22px; height: 22px; border-radius: 6px; background: rgba(255, 255, 255, .13);
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; flex: none;
}
.nav-item.active .nav-ic { background: rgba(255, 255, 255, .22); }
.badge {
  margin-left: auto; background: #f97316; color: #fff; font-size: 11px;
  border-radius: 99px; padding: 1px 7px; min-width: 18px; text-align: center;
}
.side-foot { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
.staff-line { display: flex; align-items: center; gap: 8px; color: #e6eefc; font-size: 13px; margin-bottom: 8px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #4f8bff, #1d4ed8);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; flex: none;
}
.logout { font-size: 12px; color: #7e9ad1; cursor: pointer; text-decoration: none; }
.logout:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--line); padding: 0 24px; height: 60px;
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 5;
}
.topbar-left { display: flex; align-items: center; min-width: 0; }
.menu-btn {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  width: 38px; height: 38px; margin-right: 8px; flex: none;
  border: 0; background: var(--brand-soft); border-radius: 9px; cursor: pointer; padding: 0 9px;
}
.menu-btn span { height: 2px; border-radius: 2px; background: var(--brand-dark); }
.page-title { font-size: 18px; font-weight: 700; white-space: nowrap; }
.top-right { display: flex; gap: 8px; align-items: center; }
.content { padding: 20px 24px 40px; }

/* ---------- 通用组件 ---------- */
.btn {
  border: 1px solid transparent; border-radius: 10px; padding: 8px 14px; font-size: 13px;
  cursor: pointer; background: #eef3fb; color: #1f2937; transition: all .15s; line-height: 1.4;
}
.btn:hover { filter: brightness(.96); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { background: #fdecea; color: var(--danger); }
.btn-danger:hover { background: #fbd9d5; }
.btn-success { background: #e7f8f0; color: #0b8a61; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: .3px; color: #0f2b6b; }
.stat-value small { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.stat-sub { font-size: 12px; color: var(--muted); }
.stat-card.tone-green { border-top: 3px solid var(--brand); }
.stat-card.tone-blue { border-top: 3px solid var(--brand-sky); }
.stat-card.tone-orange { border-top: 3px solid var(--warn); }
.stat-card.tone-red { border-top: 3px solid var(--danger); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 14px;
  font-size: 13px; color: #475569; cursor: pointer;
}
.pill.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pill .num { opacity: .75; margin-left: 4px; }
.input {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 13px;
  outline: none; background: #fff; min-width: 180px; color: var(--ink);
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; color: #64748b; font-weight: 600; font-size: 12px; padding: 10px 12px;
  border-bottom: 1px solid var(--line); background: #f8faff; white-space: nowrap;
}
.tbl td { padding: 11px 12px; border-bottom: 1px solid #eef2f8; vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #f0f6ff; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11px;
  background: #eef1f6; color: #475569; white-space: nowrap;
}
.tag-green { background: #e2f7ee; color: #0b7f58; }
.tag-blue { background: #e8f0fe; color: #1d4ed8; }
.tag-orange { background: #fdf0df; color: #b45309; }
.tag-red { background: #fde8e6; color: #b91c1c; }
.tag-gray { background: #eef1f4; color: #64748b; }
.tag-purple { background: #f1e9fd; color: #6d28d9; }
.empty { text-align: center; color: #94a3b8; padding: 48px 0; font-size: 13px; }
.loading { color: #94a3b8; text-align: center; padding: 40px 0; }
.muted { color: var(--muted); }
.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.money.plus { color: #0b8a61; }
.money.minus { color: var(--danger); }

.chart-bar { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding: 12px 6px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; min-width: 0; }
.chart-bar-inner { width: 26%; max-width: 14px; background: linear-gradient(180deg, #7fb0ff, #2f6bff); border-radius: 4px 4px 0 0; min-height: 2px; }
.chart-col.done .chart-bar-inner { background: linear-gradient(180deg, #4d82ff, #1e40af); }
.chart-date { font-size: 11px; color: var(--muted); }
.chart-num { font-size: 11px; color: #334155; font-weight: 600; }

.media-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.media-img {
  width: 72px; height: 72px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line); background: #f2f6fc; cursor: pointer;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(10, 25, 60, .5);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(10, 25, 60, .3); }
.modal.wide { max-width: 760px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { border: 0; background: none; font-size: 20px; cursor: pointer; color: #94a3b8; line-height: 1; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 12px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid #eef2f8; flex-wrap: wrap; }
textarea.input { width: 100%; min-height: 84px; resize: vertical; font-family: inherit; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 18px; }
.detail-item { }
.detail-item .k { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.detail-item .v { font-size: 13px; font-weight: 500; word-break: break-all; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 99;
  background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; box-shadow: 0 8px 24px rgba(15, 23, 42, .2);
}
.toast.ok { background: var(--brand-dark); }
.toast.err { background: var(--danger); }

.section-title { font-weight: 700; font-size: 15px; margin: 4px 0 10px; }
.panel { margin-bottom: 18px; }
.card-pad { padding: 16px 18px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin: 8px 0 4px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.hint {
  margin: 10px 2px 4px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  color: #8a6d1a;
  background: #fff8e1;
  border: 1px solid #f2e3b3;
}
.warn-box {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.7;
  color: #9c2f2f;
  background: #fdf1f1;
  border: 1px solid #f3cfcf;
}

/* ================= 移动端适配（抽屉式导航） ================= */
@media (max-width: 860px) {
  .app { display: block; }
  .menu-btn { display: flex; }
  .topbar { padding: 0 14px; height: 54px; }
  .page-title { font-size: 16px; }
  .content { padding: 14px 14px 40px; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 236px;
    height: 100vh; z-index: 70; box-shadow: none;
    transform: translateX(-104%); transition: transform .25s ease;
  }
  .app.nav-open .sidebar { transform: translateX(0); box-shadow: 16px 0 48px rgba(6, 18, 48, .3); }
  .side-mask {
    display: block; position: fixed; inset: 0; z-index: 65;
    background: rgba(8, 20, 48, .45);
    opacity: 0; visibility: hidden; transition: opacity .25s ease;
  }
  .app.nav-open .side-mask { opacity: 1; visibility: visible; }

  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .stat-card { padding: 13px 14px; }
  .stat-value { font-size: 20px; }
  .card-pad { padding: 14px; }
  .pills { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .pills::-webkit-scrollbar { display: none; }
  .pill { flex: none; }
  .toolbar .input { width: 100%; min-width: 0; flex: 1 1 100%; }
  .toolbar .btn { flex: none; }
  .detail-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

  .modal-mask { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .modal.wide { max-width: 100%; }
  .modal-foot { position: sticky; bottom: 0; background: #fff; }

  .btn { min-height: 34px; }
  .btn-sm { min-height: 28px; }
}
@media (max-width: 480px) {
  .brand-name { font-size: 15px; }
  .login-card { padding: 28px 20px 22px; }
  .tbl th, .tbl td { padding: 9px 10px; }
  .field input, .btn-block { min-height: 44px; }
}

/* ================= 扩展：账号 / 公告 / 系统设置 ================= */
.perm-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.perm-box {
  display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 11px; cursor: pointer; background: #fff; font-size: 13px;
}
.perm-box:hover { border-color: var(--brand); background: var(--brand-soft); }
.perm-box input { margin-top: 2px; accent-color: var(--brand); }
.perm-box .d { font-size: 11px; color: var(--muted); }
.perm-box.on { border-color: var(--brand); background: var(--brand-soft); }
.perm-tag { display: inline-flex; align-items: center; gap: 4px; margin: 2px 4px 2px 0; }
.check-row { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 4px 0; }
.check-row label { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; cursor: pointer; }
.check-row input { accent-color: var(--brand); }
.form-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; }
.num-input { display: inline-flex; align-items: center; gap: 8px; }
.num-input input { width: 120px; }
.fee-preview { background: #f6f9ff; border: 1px dashed #c9d9f7; border-radius: 10px; padding: 10px 14px; margin: 8px 0 14px; font-size: 13px; line-height: 1.8; color: #334155; }
.fee-preview b { color: #1d4ed8; }
.savebar { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.savebar .st { font-size: 12px; color: #0b8a61; }

