:root {
  /* ── 青竹 · 出版级设计 token（与小程序一致）── */
  --ink: #234A34;        /* 墨绿 主操作/标题 */
  --bamboo: #3D6B4F;     /* 竹青 次强调/达标 */
  --paper: #F8F6F0;      /* 宣纸 页面底 */
  --card: #FFFDF8;       /* 暖白 卡面 */
  --line: #E6E2D4;       /* 驼线 描边 */
  --gold: #B8935A;       /* 赭金 数据高亮/待改 */
  --rust: #B4725F;       /* 赭红 风险 */
  --text: #2A332C;       /* 正文 */
  --muted: #77816F;      /* 次要 */
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--bamboo); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ── 布局 ── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--ink); color: #EAF1E8;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  padding: 22px 20px; font-size: 16px; font-weight: 700;
  letter-spacing: .5px; color: #F6F3E7;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand small { display:block; font-size: 11px; font-weight: 400; color:#A9C0AC; margin-top:3px; letter-spacing:0; }
.sidebar nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 8px; margin-bottom: 4px;
  color: #C8D8C6; font-size: 14px; cursor: pointer; user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #F6F3E7; }
.nav-item.active { background: var(--bamboo); color: #fff; font-weight: 600; }
.nav-item .ic { width: 18px; text-align: center; opacity: .9; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 58px; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 5;
}
.topbar .title { font-size: 16px; font-weight: 600; color: var(--ink); }
.topbar .right { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
.content { padding: 24px; flex: 1; }

/* ── 卡片 / 网格 ── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
}
.card h3 { margin: 0 0 14px; font-size: 15px; color: var(--ink); }
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
/* 网格内部统一用 gap 控制间距，避免卡片自带 margin 造成横纵不一致 */
.grid > .card, .grid > .stat { margin-bottom: 0; }
@media (max-width: 980px){ .grid.cols-4,.grid.cols-3{grid-template-columns:repeat(2,1fr);} .sidebar{width:64px;} .sidebar .brand small, .nav-item span.txt{display:none;} }

.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
}
.stat .label { color: var(--muted); font-size: 13px; }
.stat .num { font-size: 26px; font-weight: 700; color: var(--ink); margin-top: 6px; }
.stat .num.gold { color: var(--gold); }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── 表格 ── */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
table.tbl th { color: var(--muted); font-weight: 600; background: #FAF8F1; position: sticky; top: 0; }
table.tbl tr:hover td { background: #FBFAF4; }
.table-wrap { overflow-x: auto; }

/* ── 表单 / 控件 ── */
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
input, select, textarea {
  font-family: inherit; font-size: 13px; color: var(--text); line-height: 1.4;
  background: #FBFAF4; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--bamboo); box-shadow: 0 0 0 2px rgba(61,107,79,.12); }
/* 下拉框：统一样式 + 自定义箭头，消除不同浏览器左右内边距不一致 */
select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%2377816F' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
select::-ms-expand { display: none; }
/* 日期文本输入：统一 YYYY-MM-DD 显示，避免原生 date 在不同地区显示斜杠 */
input.date {
  width: 140px; text-align: center; letter-spacing: .5px; color: var(--muted);
}
input.date:focus { color: var(--text); }
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; background: #EEF4EC; color: var(--bamboo); border: 1px solid #DCE7D8;
}
.tag.mode-points { background: #F4ECDC; color: var(--gold); border-color: #E8D6AE; }
.tag.mode-custom { background: #F2E3DE; color: var(--rust); border-color: #E6C7BC; }
.tag.mode-default { background: #EEF4EC; color: var(--bamboo); border-color: #DCE7D8; }

.btn {
  background: var(--ink); color: #F6F3E7; border: none;
  border-radius: 8px; padding: 8px 16px; font-size: 13px;
}
.btn:hover { background: #1B3A29; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #F1EEE4; }
.btn.gold { background: var(--gold); }
.btn.danger { background: var(--rust); }
.btn.sm { padding: 5px 11px; font-size: 12px; }
.muted { color: var(--muted); }
.right-align { text-align: right; }
.nowrap { white-space: nowrap; }
.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin-top: 14px; }

/* ── 弹窗 ── */
.modal-mask { position: fixed; inset: 0; background: rgba(35,74,52,.32); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal {
  background: var(--card); border-radius: 14px; width: 560px; max-width: 92vw;
  max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.modal .m-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display:flex; justify-content: space-between; align-items:center; }
.modal .m-head h3 { margin: 0; color: var(--ink); font-size: 15px; }
.modal .m-body { padding: 20px; }
.modal .m-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.x { cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; }

/* ── 登录 ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg,#234A34 0%,#3D6B4F 100%); }
.login-card { width: 360px; background: var(--card); border-radius: 16px; padding: 34px 30px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-card .logo { text-align: center; margin-bottom: 22px; }
.login-card .logo .t { font-size: 20px; font-weight: 700; color: var(--ink); }
.login-card .logo .s { font-size: 12px; color: var(--muted); margin-top: 4px; }
.login-card .btn { width: 100%; margin-top: 6px; padding: 11px; }

/* ── toast ── */
#toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.2); animation: pop .2s ease; }
.toast.err { background: var(--rust); }
.toast.ok { background: var(--bamboo); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ── 图表 ── */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12px; }
.bar-row .name { width: 90px; color: var(--muted); text-align: right; }
.bar-row .track { flex: 1; background: #F1EEE4; border-radius: 6px; height: 16px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--bamboo); border-radius: 6px; }
.bar-row .val { width: 48px; color: var(--text); }
.legend { display:flex; gap:14px; flex-wrap:wrap; font-size:12px; color:var(--muted); margin-top:10px; }
.legend i { display:inline-block; width:10px; height:10px; border-radius:2px; margin-right:5px; vertical-align:middle; }
