:root {
  --brand: #1F7A5C;
  --brand2: #35A07A;
  --brand-deep: #155C44;
  --accent: #C08A2E;
  --bg: #F6F4EE;
  --surface: #FFFFFF;
  --surface2: #EFEAE0;
  --text: #1B2A24;
  --text2: #5A6B62;
  --text3: #8B978F;
  --border: #E6E0D4;
  --success: #2E8B57;
  --danger: #B4443A;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27,42,36,.04), 0 8px 24px rgba(27,42,36,.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: radial-gradient(1200px 600px at 20% 10%, #E8F2EC 0%, var(--bg) 55%);
}
.login-left {
  padding: 72px 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 26px;
}
.brand-mark {
  width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(150deg, #2E9E7A, var(--brand-deep));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; letter-spacing: 1px;
}
.login-title { font-size: 34px; font-weight: 700; letter-spacing: -.5px; margin: 0; }
.login-sub { color: var(--text2); line-height: 1.9; font-size: 14px; max-width: 420px; }
.role-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.role-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 16px; border-radius: 12px;
  background: rgba(255,255,255,.7); border: 1px solid var(--border);
}
.role-item b { font-size: 13.5px; }
.role-item span { color: var(--text3); font-size: 12px; }
.role-chip {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  background: rgba(31,122,92,.1); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.role-chip.t { background: rgba(47,107,255,.1); color: #2F6BFF; }
.role-chip.s { background: rgba(192,138,46,.14); color: var(--accent); }

.login-right { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card {
  width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 34px 32px; box-shadow: var(--shadow);
}
.login-card h2 { margin: 0 0 6px; font-size: 20px; }
.login-card p.hint { margin: 0 0 24px; color: var(--text3); font-size: 12.5px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 7px; font-weight: 600; }
.field input {
  width: 100%; height: 44px; padding: 0 14px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 11px; background: #FCFBF8;
  outline: none; transition: .16s;
}
.field input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(31,122,92,.1); }
.btn {
  height: 44px; padding: 0 18px; border-radius: 11px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font-size: 13.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: .16s;
}
.btn:hover { border-color: #D7CFBE; background: #FBFAF6; }
.btn.primary {
  background: linear-gradient(150deg, var(--brand2), var(--brand-deep));
  color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(31,122,92,.24);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.block { width: 100%; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #EBD5D1; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.demo-box {
  margin-top: 20px; padding: 13px 14px; border-radius: 11px;
  background: #F7F5EF; border: 1px dashed var(--border);
  font-size: 12px; color: var(--text2); line-height: 1.9;
}
.demo-box code { background: rgba(31,122,92,.08); color: var(--brand); padding: 1px 6px; border-radius: 5px; }

/* ---------------- 主框架 ---------------- */
.shell { display: grid; grid-template-columns: 238px 1fr; min-height: 100vh; }
.sidebar {
  background: #12291F;
  color: #DCE9E3;
  padding: 22px 14px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; gap: 11px; align-items: center; padding: 4px 8px 22px; }
.side-brand .logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(150deg, #2E9E7A, #0E3D2C);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 18px;
}
.side-brand b { font-size: 15px; display: block; color: #fff; }
.side-brand span { font-size: 11px; color: #7E988C; }
.nav-group { margin-top: 6px; }
.nav-label {
  font-size: 10.5px; letter-spacing: .12em; color: #6D8579;
  padding: 14px 10px 8px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; font-size: 13.5px;
  color: #C3D6CC; cursor: pointer; transition: .14s; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.on { background: rgba(53,160,122,.2); color: #fff; font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; opacity: .85; }
.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.side-user { display: flex; gap: 10px; align-items: center; padding: 8px 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: rgba(255,255,255,.12); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.side-user b { font-size: 13px; color: #fff; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who { min-width: 0; flex: 1; }
.side-user .who .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user span { font-size: 11px; color: #7E988C; }
.logout { color: #9DB3A8; font-size: 12px; margin-left: auto; cursor: pointer; }
.logout:hover { color: #fff; }

.main { padding: 26px 32px 48px; min-width: 0; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
.topbar h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.3px; }
.topbar .sub { color: var(--text3); font-size: 12.5px; }
.topbar .right { display: flex; gap: 9px; align-items: center; }

/* ---------------- 组件 ---------------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.cards.three { grid-template-columns: repeat(3, 1fr); }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.stat .k { font-size: 11.5px; color: var(--text3); font-weight: 600; letter-spacing: .02em; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.6px; }
.stat .v small { font-size: 13px; font-weight: 600; color: var(--text3); margin-left: 3px; }
.stat .d { font-size: 11.5px; color: var(--text3); margin-top: 4px; }
.stat.accent { background: linear-gradient(150deg, #1F7A5C, #12452F); border-color: transparent; color: #fff; }
.stat.accent .k, .stat.accent .d { color: rgba(255,255,255,.72); }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.panel-head h3 { margin: 0; font-size: 14.5px; }
.panel-head .hint { color: var(--text3); font-size: 12px; }
.panel-body { padding: 4px 0; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11.5px; color: var(--text3); font-weight: 600;
  padding: 10px 18px; border-bottom: 1px solid var(--border); white-space: nowrap;
  background: #FCFBF8;
}
td { padding: 13px 18px; border-bottom: 1px solid #F1EDE4; font-size: 13.5px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FBFAF6; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .name { font-weight: 600; }
td .meta { color: var(--text3); font-size: 11.5px; margin-top: 2px; }
.rowlink { cursor: pointer; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 600;
  background: var(--surface2); color: var(--text2);
}
.badge.ok { background: rgba(46,139,87,.12); color: var(--success); }
.badge.warn { background: rgba(192,138,46,.14); color: var(--accent); }
.badge.off { background: #EFEAE0; color: var(--text3); }
.badge.dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.search {
  height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; font-size: 13px; outline: none; width: 240px;
}
.search:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,122,92,.1); }
.empty { padding: 46px 20px; text-align: center; color: var(--text3); font-size: 13px; }
.empty b { display: block; color: var(--text2); margin-bottom: 6px; font-size: 14px; }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(18,41,31,.42);
  backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 24px;
}
.modal {
  width: 480px; max-width: 100%; background: #fff; border-radius: 18px;
  box-shadow: 0 24px 64px rgba(18,41,31,.28); overflow: hidden;
  animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: .7; } }
.modal-head { padding: 20px 22px 6px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head p { margin: 6px 0 0; color: var(--text3); font-size: 12.5px; }
.modal-body { padding: 16px 22px 4px; }
.modal-foot { padding: 14px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.err { color: var(--danger); font-size: 12.5px; margin-top: 10px; min-height: 16px; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: #12291F; color: #fff; padding: 11px 20px; border-radius: 11px;
  font-size: 13px; z-index: 80; box-shadow: 0 12px 30px rgba(0,0,0,.24);
  animation: fade .18s ease-out;
}
@keyframes fade { from { opacity: 0; transform: translate(-50%, 6px); } }

.detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; padding: 16px 18px; }
.kv dt { color: var(--text3); font-size: 12.5px; }
.kv dd { margin: 0; font-size: 13.5px; }

.back-link { color: var(--text3); font-size: 12.5px; cursor: pointer; margin-bottom: 8px; display: inline-block; }
.back-link:hover { color: var(--brand); }

@media (max-width: 1080px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-left { padding: 44px 32px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; }
  .side-brand, .side-foot { display: none; }
  .nav-group { display: flex; margin: 0; }
  .nav-label { display: none; }
}

/* ---------------- 会员详情抽屉 ---------------- */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(18,41,31,.36);
  backdrop-filter: blur(2px); z-index: 60; display: flex; justify-content: flex-end;
  animation: fadein .14s ease-out;
}
@keyframes fadein { from { background: rgba(18,41,31,0); } }
.drawer {
  width: 560px; max-width: 92vw; height: 100%; background: var(--bg);
  box-shadow: -18px 0 48px rgba(18,41,31,.24); display: flex; flex-direction: column;
  animation: slidein .18s ease-out;
}
@keyframes slidein { from { transform: translateX(28px); } to { transform: translateX(0); } }
.drawer-head {
  padding: 22px 24px 16px; background: linear-gradient(150deg, #248468, #12452F); color: #fff;
}
.drawer-head .row { display: flex; align-items: flex-start; justify-content: space-between; }
.drawer-head h2 { margin: 0 0 6px; font-size: 21px; }
.drawer-head .meta { font-size: 12.5px; color: rgba(255,255,255,.78); }
.drawer-close { background: rgba(255,255,255,.14); border: none; color: #fff; width: 30px; height: 30px;
  border-radius: 9px; font-size: 16px; line-height: 1; }
.drawer-close:hover { background: rgba(255,255,255,.24); }
.drawer-stats { display: flex; gap: 22px; margin-top: 16px; }
.drawer-stats div { font-size: 11.5px; color: rgba(255,255,255,.7); }
.drawer-stats b { display: block; font-size: 19px; color: #fff; margin-top: 2px; font-weight: 700; }
.drawer-tabs { display: flex; gap: 4px; padding: 12px 18px 0; background: var(--bg);
  border-bottom: 1px solid var(--border); }
.dtab { padding: 9px 14px; font-size: 13px; color: var(--text2); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.dtab:hover { color: var(--text); }
.dtab.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }
.drawer-foot { padding: 14px 18px 18px; border-top: 1px solid var(--border); background: #fff;
  display: flex; gap: 10px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; padding: 14px 16px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.info-grid .k { font-size: 11.5px; color: var(--text3); }
.info-grid .v { font-size: 13.5px; margin-top: 2px; }
.tl { display: flex; flex-direction: column; gap: 9px; }
.tl-item { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.tl-item .t { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.tl-item .t b { font-size: 13.5px; }
.tl-item .t span { font-size: 11.5px; color: var(--text3); white-space: nowrap; }
.tl-item .s { font-size: 12px; color: var(--text2); margin-top: 5px; line-height: 1.6; }
.tl-item .tag { display: inline-block; font-size: 10.5px; padding: 2px 7px; border-radius: 6px;
  background: rgba(31,122,92,.1); color: var(--brand); margin-right: 6px; }
.ptx { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px;
  background: #fff; border: 1px solid var(--border); border-radius: 11px; }
.ptx + .ptx { margin-top: 8px; }
.ptx .d { font-size: 15px; font-weight: 700; }
.ptx .d.plus { color: var(--success); }
.ptx .d.minus { color: var(--text2); }
.ptx .n { font-size: 12px; color: var(--text2); }
.ptx .m { font-size: 11px; color: var(--text3); }

.imggrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.imgcell { border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: #fff; cursor: zoom-in; }
.imgcell img { width: 100%; height: 96px; object-fit: cover; display: block; }
.imeta { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text3); padding: 5px 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.yn { display: flex; align-items: center; gap: 8px; padding: 9px 0; font-size: 13px; color: var(--text2); }
.yn span { flex: 1; }
.shot { width: 92px; height: 68px; border-radius: 9px; overflow: hidden; border: 1px solid var(--border); }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.imgcell.sel { outline: 3px solid var(--brand); outline-offset: -3px; }
.imgcell .ck { position: absolute; right: 6px; top: 6px; width: 20px; height: 20px; border-radius: 6px;
  background: rgba(255,255,255,.9); border: 1px solid var(--border); display: flex; align-items: center;
  justify-content: center; font-size: 12px; color: var(--brand); font-weight: 700; }
.imgcell { position: relative; }
.fpill { display: inline-block; font-size: 12.5px; padding: 7px 11px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text2); cursor: pointer;
  transition: .14s; }
.fpill:hover { border-color: #D7CFBE; }
.fpill.on { background: rgba(31,122,92,.1); border-color: var(--brand); color: var(--brand); font-weight: 600; }

.caplist { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.caprow { display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--border);
  border-radius: 11px; padding: 8px 10px; }
.caprow img { width: 56px; height: 42px; object-fit: cover; border-radius: 7px; flex: none; }
.capinput { flex: 1; height: 34px; border: 1px solid var(--border); border-radius: 9px; padding: 0 11px;
  font-size: 12.5px; background: #FCFBF8; outline: none; }
.capinput:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(31,122,92,.1); }

.imgcap { font-size: 10.5px; color: var(--text2); padding: 0 7px 7px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.capedit { position: absolute; left: 6px; top: 6px; width: 22px; height: 22px; border-radius: 7px;
  border: none; background: rgba(255,255,255,.88); color: var(--brand); font-size: 12px;
  display: none; align-items: center; justify-content: center; }
.imgcell:hover .capedit { display: flex; }

.banner { border-radius: 12px; padding: 12px 16px; font-size: 13px; margin-bottom: 16px; line-height: 1.7; }
.banner.warn { background: rgba(192,138,46,.12); border: 1px solid rgba(192,138,46,.35); color: #7A5715; }
.banner.danger { background: rgba(180,68,58,.1); border: 1px solid rgba(180,68,58,.3); color: #8C2F27; }
.cards.five { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1200px) { .cards.five { grid-template-columns: repeat(3, 1fr); } }

.poolstat { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.poolstat > div { background: #FBFAF6; border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; }
.poolstat .k { font-size: 11px; color: var(--text3); }
.poolstat .v { font-size: 20px; font-weight: 700; margin-top: 4px; letter-spacing: -.4px; }
.poolstat .v.sm { font-size: 15px; color: var(--text2); }
.poolstat .v.ok { color: var(--success); }
.poolstat .v.accent { color: var(--brand); }
@media (max-width: 1200px) { .poolstat { grid-template-columns: repeat(3, 1fr); } }
