/* ============================================================
   打卡存钱局 · 后台管理
   布局：左侧深棕导航 + 右侧浅色内容区，主色沿用品牌橙
   ============================================================ */

:root {
  --primary: #ff9f1c;
  --primary-dark: #e8871a;
  --accent: #2ec4b6;
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #2b2118;
  --ink-2: #6b6259;
  --ink-3: #9a9189;
  --line: #ececf0;
  --side: #2b2118;
  --side-2: #382b1f;
  --danger: #f53f3f;
  --ok: #2ba471;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 15, 10, 0.04), 0 8px 24px rgba(20, 15, 10, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }
button, input, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: 0; background: none; color: inherit; }

/* ---------------- 登录 ---------------- */
.login {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(700px 420px at 20% 10%, #ffd9a0 0%, transparent 60%),
    radial-gradient(600px 400px at 85% 90%, #ffe9c9 0%, transparent 60%),
    #fdf6ec;
  z-index: 100;
}
.login[hidden] { display: none; }
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 22px;
  padding: 34px 30px 26px;
  box-shadow: 0 30px 80px rgba(120, 80, 30, 0.16);
  border: 1px solid #f3e8d8;
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.login-mark {
  width: 50px; height: 50px;
  border-radius: 15px;
  background: linear-gradient(135deg, #fff1d8, #ffe0b0);
  display: grid; place-items: center;
  font-size: 26px;
  box-shadow: inset 0 0 0 1px rgba(255, 159, 28, 0.18);
}
.login-brand h1 { font-size: 20px; letter-spacing: 0.01em; }
.login-brand p { font-size: 12.5px; color: var(--ink-3); }
#loginForm label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
#loginForm input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fbfbfd;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#loginForm input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 159, 28, 0.12);
}
.login-error {
  min-height: 20px;
  font-size: 12.5px;
  color: var(--danger);
  padding: 6px 2px 2px;
}
.btn-primary {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ffb03a, var(--primary));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 8px 20px rgba(255, 159, 28, 0.3);
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(255, 159, 28, 0.36); }
.btn-primary:disabled { opacity: 0.6; cursor: default; transform: none; box-shadow: none; }
.login-tip { margin-top: 18px; font-size: 11.5px; color: var(--ink-3); text-align: center; }
.login-tip code {
  font-size: 11px;
  background: #f6f2ec;
  padding: 2px 6px;
  border-radius: 5px;
  color: #8a6a44;
}

/* ---------------- 主框架 ---------------- */
.app { display: flex; min-height: 100vh; }
.app[hidden] { display: none; }

.sidebar {
  width: 232px;
  flex: none;
  background: linear-gradient(180deg, var(--side) 0%, var(--side-2) 100%);
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; }
.side-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.1);
  display: grid; place-items: center;
  font-size: 19px;
}
.side-name { font-size: 15px; font-weight: 700; color: #fff; }
.side-sub { font-size: 11px; color: rgba(255, 255, 255, 0.42); }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.68);
  text-align: left;
  transition: background 0.2s ease, color 0.2s ease;
}
.nav-item span { font-size: 15px; opacity: 0.9; }
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item.is-active {
  background: linear-gradient(100deg, rgba(255, 159, 28, 0.22), rgba(255, 159, 28, 0.06));
  color: #fff;
  box-shadow: inset 2px 0 0 var(--primary);
}
.side-foot { margin-top: auto; padding: 14px 8px 4px; font-size: 12.5px; }
.side-foot a { color: rgba(255, 255, 255, 0.45); transition: color 0.2s ease; }
.side-foot a:hover { color: var(--primary); }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-title h2 { font-size: 19px; letter-spacing: -0.01em; }
.topbar-title p { font-size: 12.5px; color: var(--ink-3); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(43, 164, 113, 0.14);
  margin-right: 4px;
}
.btn-ghost {
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  color: var(--ink-2);
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.btn-ghost:hover { border-color: #dcd7cf; color: var(--ink); background: #fbfaf8; }
.btn-sm { width: auto; height: 38px; padding: 0 18px; font-size: 13.5px; border-radius: 9px; }

.content { padding: 24px 28px 40px; }

/* ---------------- 统计卡 ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  right: -18px; top: -18px;
  width: 62px; height: 62px;
  border-radius: 50%;
  background: rgba(255, 159, 28, 0.08);
}
.stat-label { font-size: 12.5px; color: var(--ink-3); }
.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin-top: 6px; }
.stat-value small { font-size: 13px; font-weight: 600; color: var(--ink-3); margin-left: 3px; }
.stat-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.stat.hl .stat-value { color: var(--primary-dark); }

/* ---------------- 面板 ---------------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 8px;
  margin-bottom: 18px;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
}
.panel-head h3 { font-size: 15px; }
.panel-hint { font-size: 12px; color: var(--ink-3); }

/* ---------------- 柱状图 ---------------- */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 190px;
  padding: 8px 4px 26px;
  position: relative;
}
.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink-3);
  font-size: 13px;
}
.bar-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  position: relative;
}
.bar {
  width: 100%;
  max-width: 34px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #ffbf69, var(--primary));
  min-height: 3px;
  transition: height 0.6s cubic-bezier(0.22, 1, 0.36, 1), filter 0.2s ease;
  position: relative;
}
.bar.zero { background: #efece7; }
.bar-col:hover .bar { filter: brightness(1.06); }
.bar-col .bar-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  background: #2b2118;
  color: #fff;
  font-size: 11.5px;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 3;
}
.bar-col:hover .bar-tip { opacity: 1; transform: none; }
.bar-label { font-size: 10.5px; color: var(--ink-3); }

/* ---------------- 双列 ---------------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mini-list { padding-bottom: 10px; }
.mini-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px dashed #f2f0ec;
}
.mini-row:last-child { border-bottom: 0; }
.mini-avatar {
  width: 34px; height: 34px;
  flex: none;
  border-radius: 10px;
  background: #fff6e8;
  display: grid; place-items: center;
  font-size: 16px;
}
.mini-main { flex: 1; min-width: 0; }
.mini-main p { font-size: 13.5px; font-weight: 600; }
.mini-main span { font-size: 11.5px; color: var(--ink-3); }
.mini-right { font-size: 13px; font-weight: 700; color: var(--primary-dark); text-align: right; }
.mini-right small { display: block; font-size: 11px; font-weight: 500; color: var(--ink-3); }
.empty { padding: 26px 0; text-align: center; color: var(--ink-3); font-size: 13px; }

/* ---------------- 工具栏 / 表格 ---------------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 2px 0 16px;
}
.toolbar input[type="search"] {
  height: 38px;
  min-width: 240px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fbfbfd;
  outline: none;
  font-size: 13.5px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.toolbar input[type="search"]:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 159, 28, 0.1);
}
.toolbar select {
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13.5px;
  color: var(--ink-2);
  outline: none;
}
.toolbar-count { margin-left: auto; font-size: 12.5px; color: var(--ink-3); }

.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 760px; }
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 10px 12px;
  background: #fafaf8;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table th:first-child { border-radius: 8px 0 0 8px; }
.table th:last-child { border-radius: 0 8px 8px 0; }
.table td {
  padding: 13px 12px;
  border-bottom: 1px solid #f4f3f0;
  color: var(--ink-2);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fdfcf9; }
.table .strong { color: var(--ink); font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; color: var(--ink-3); }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell img, .user-cell .ava {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff6e8;
  display: grid; place-items: center;
  font-size: 14px;
  flex: none;
}
.bar-mini {
  width: 92px;
  height: 6px;
  border-radius: 999px;
  background: #f0ede8;
  overflow: hidden;
}
.bar-mini i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffbf69, var(--primary));
}
.pct { font-size: 12px; color: var(--ink-3); margin-left: 8px; }
.chip {
  display: inline-block;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f2f6f4;
  color: #3d8f70;
}
.chip.done { background: #fff3df; color: #b5720d; }
.chip.danger { background: #fdecec; color: var(--danger); cursor: pointer; }

/* ---------------- 分页 ---------------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 14px 0 12px;
}
.pager button {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12.5px;
  color: var(--ink-2);
  transition: border-color 0.2s ease, color 0.2s ease;
}
.pager button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-dark); }
.pager button.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.pager .pager-info { font-size: 12px; color: var(--ink-3); margin-right: 8px; }

/* ---------------- 社区动态 ---------------- */
.post-list { display: flex; flex-direction: column; gap: 12px; padding-bottom: 10px; }
.post {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: #fdfcf9;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.post:hover { border-color: #e6ddcd; background: #fff; }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-user { font-size: 13.5px; font-weight: 600; }
.post-time { font-size: 11.5px; color: var(--ink-3); }
.post-type {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff3df;
  color: #b5720d;
}
.post-body { margin: 10px 0 8px; font-size: 13.5px; color: var(--ink-2); line-height: 1.6; }
.post-foot { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--ink-3); }
.post-foot .del { margin-left: auto; color: var(--danger); cursor: pointer; font-size: 12px; }
.post-foot .del:hover { text-decoration: underline; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 12px);
  background: #2b2118;
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 200;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .sidebar {
    width: 68px;
    padding: 18px 8px 12px;
  }
  .side-brand div, .nav-item span + * , .side-name, .side-sub, .side-foot { display: none; }
  .nav-item { justify-content: center; font-size: 0; padding: 12px 0; }
  .nav-item span { font-size: 18px; }
  .side-mark { width: 40px; height: 40px; }
  .side-brand { justify-content: center; padding: 0 0 18px; }
  .two-col { grid-template-columns: 1fr; }
  .content { padding: 18px 16px 32px; }
  .topbar { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .side-brand { display: none; }
  .topbar-title p { display: none; }
  .toolbar input[type="search"] { min-width: 0; flex: 1; }
  .stat-value { font-size: 20px; }
}

/* ---------------- 顶栏账号 ---------------- */
.whoami {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  background: #f4f1ec;
  border: 1px solid #eee8dd;
  padding: 5px 12px;
  border-radius: 999px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.whoami::before { content: "🛡️ "; }

/* ---------------- 表格紧凑版 ---------------- */
.table-compact { min-width: 0; }

/* ---------------- 弹窗 ---------------- */
.modal { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(30, 22, 14, 0.45); backdrop-filter: blur(3px); }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 18px;
  padding: 26px 26px 22px;
  box-shadow: 0 30px 80px rgba(30, 22, 14, 0.3);
  animation: modal-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal-card h3 { font-size: 17px; margin-bottom: 18px; }
.modal-card h3 small { font-size: 12.5px; color: var(--ink-3); font-weight: 500; margin-left: 6px; }
.modal-card label {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin: 14px 0 6px;
}
.modal-card label:first-of-type { margin-top: 0; }
.field-hint { font-size: 11.5px; color: var(--ink-3); margin-left: 6px; }
.modal-card input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fbfbfd;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.modal-card input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 159, 28, 0.12);
}
.modal-error { min-height: 20px; font-size: 12.5px; color: var(--danger); padding-top: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.modal-actions .btn-ghost { height: 40px; padding: 0 16px; }
.modal-actions .btn-primary { width: auto; height: 40px; padding: 0 18px; }

@media (max-width: 560px) {
  .whoami { display: none; }
  .topbar-actions { gap: 6px; }
  #refreshBtn { display: none; }
}
