/* 晨读会成长学院 · 后台管理框架样式 —— 说明书第8章 Admin Dashboard */
:root {
  --brand: #2E7D32; --brand-d: #1B5E20; --brand-l: #E8F3E9;
  --ai: #4F46E5; --accent: #F59E0B; --bg: #F1F5F9; --surface: #fff;
  --text: #1F2937; --muted: #6B7280; --line: #E5E7EB; --radius: 12px;
  --sidebar: 236px; --shadow: 0 1px 3px rgba(16,24,40,.06), 0 4px 14px rgba(16,24,40,.05);
  --font: -apple-system, "PingFang SC", "Microsoft YaHei", "Inter", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(800px 400px at 20% 0%, rgba(46,125,50,.14), transparent 60%), var(--bg); }
.login-card { background: #fff; width: 360px; padding: 34px; border-radius: 16px; box-shadow: 0 12px 40px rgba(16,24,40,.14); }
.login-card .lb { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; margin-bottom: 4px; }
.login-card .lb .lg { height: 30px; width: auto; display: block; }
.login-card p.hint { color: var(--muted); margin: 0 0 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; outline: none; }
.field textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(46,125,50,.12); }
.err { color: #dc2626; min-height: 20px; font-size: 13px; margin-top: 6px; }

/* layout */
.app { display: none; min-height: 100vh; }
.app.on { display: block; }
.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar); background: #0f2417; color: #cbd5c6;
  display: flex; flex-direction: column; z-index: 40; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px; font-weight: 800; color: #fff; font-size: 16px; }
.sidebar .brand .lg { height: 26px; width: auto; display: block; }
.menu { flex: 1; overflow-y: auto; padding: 8px; }
.menu .grp { color: #6f8f77; font-size: 11px; letter-spacing: 1px; padding: 14px 12px 6px; }
.menu a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: #cbd5c6; margin-bottom: 2px; cursor: pointer; }
.menu a .mi { width: 20px; text-align: center; }
.menu a:hover { background: rgba(255,255,255,.06); color: #fff; }
.menu a.active { background: var(--brand); color: #fff; }
.menu a .soon { margin-left: auto; font-size: 10px; background: rgba(255,255,255,.12); padding: 1px 6px; border-radius: 6px; }
.sidebar .foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #8aa691; }

.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid var(--line);
  height: 58px; display: flex; align-items: center; gap: 14px; padding: 0 24px; }
.topbar .mtoggle { display: none; border: 1px solid var(--line); background: #fff; border-radius: 8px; width: 38px; height: 38px; }
.topbar h1 { font-size: 17px; margin: 0; }
.topbar .sp { flex: 1; }
.topbar .who { color: var(--muted); }
.content { padding: 24px; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; transition: .15s; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-d); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { color: #fff; filter: brightness(.95); }
.btn-danger { color: #dc2626; }
.btn-danger:hover { border-color: #dc2626; background: #fef2f2; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }

/* pages */
.page { display: none; }
.page.on { display: block; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 20px; }
.page-head .desc { color: var(--muted); }
.page-head .sp { flex: 1; }

/* stat cards */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat .lab { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.stat .num { font-size: 28px; font-weight: 800; margin-top: 8px; }
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card .ch { padding: 16px 18px; border-bottom: 1px solid var(--line); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card .cb { padding: 6px 0; }

/* table */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; background: #fafbfc; }
tr:last-child td { border-bottom: none; }
.tbl-wrap { overflow-x: auto; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.on { background: var(--brand-l); color: var(--brand-d); }
.badge.off { background: #f1f5f9; color: #64748b; }
.badge.paid { background: #dcfce7; color: #15803d; }
.badge.pending { background: #fef3c7; color: #b45309; }
.badge.refunded { background: #fee2e2; color: #b91c1c; }
.badge.rec { background: #eef2ff; color: #4338ca; }
.row-actions { display: flex; gap: 6px; }

/* placeholder */
.soon-box { text-align: center; padding: 60px 20px; color: var(--muted); }
.soon-box .big { font-size: 46px; }
.soon-box h3 { color: var(--text); margin: 12px 0 6px; }
.soon-box ul { display: inline-block; text-align: left; margin-top: 12px; line-height: 2; }

/* modal */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: none; place-items: center; z-index: 60; padding: 20px; }
.modal-mask.on { display: grid; }
.modal { background: #fff; border-radius: 14px; width: 560px; max-width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal .mh { padding: 18px 22px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 16px; display: flex; }
.modal .mh .x { margin-left: auto; cursor: pointer; color: var(--muted); background: none; border: none; font-size: 20px; }
.modal .mb { padding: 22px; }
.modal .mf { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #0f2417; color: #fff;
  padding: 12px 22px; border-radius: 10px; z-index: 80; opacity: 0; transition: .25s; pointer-events: none; }
.toast.on { opacity: 1; }

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .topbar .mtoggle { display: inline-block; }
  .stats { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
}
