/* 社区团购 · 运营后台样式（无构建工具，纯 CSS） */

:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #1f2937;
  --ink-2: #5b6675;
  --ink-3: #8b95a5;
  --line: #e6eaf0;
  --brand: #1f7a4d;
  --brand-2: #2a9d63;
  --brand-soft: #e9f5ee;
  --warn: #b7791f;
  --warn-soft: #fdf6e7;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --info: #1d6fa5;
  --info-soft: #e8f2f9;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 14px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #16342a 0%, #1f7a4d 55%, #2a9d63 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 14px;
  padding: 32px 28px 26px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: 0.5px;
}

.login-card .sub {
  margin: 0 0 22px;
  color: var(--ink-3);
  font-size: 13px;
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--ink-2);
}

.input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(42, 157, 99, 0.14);
  background: #fff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
  transition: all .15s;
}
.btn:hover { border-color: #c9d2de; background: #f8fafc; }
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-block { width: 100%; height: 42px; font-size: 14px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn-danger { color: var(--danger); border-color: #f0c4bf; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.login-error {
  min-height: 20px;
  margin: 4px 0 10px;
  color: var(--danger);
  font-size: 13px;
}

.login-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--ink-3);
  font-size: 12px;
}

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: #16342a;
  color: #cfe3d8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand strong {
  display: block;
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.5px;
}
.brand span {
  font-size: 12px;
  color: #7fa895;
}

.nav { padding: 10px 8px; overflow-y: auto; flex: 1; }
.nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  margin-bottom: 2px;
  border-radius: 8px;
  color: #cfe3d8;
  font-size: 13.5px;
}
.nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav a.active { background: var(--brand); color: #fff; }
.nav .ico { width: 16px; text-align: center; opacity: .9; }

.sidebar-foot {
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: #7fa895;
}

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

.topbar {
  height: 56px;
  flex: 0 0 56px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h2 { margin: 0; font-size: 16px; font-weight: 600; }
.topbar .who { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: 13px; }

.content { padding: 20px 22px 40px; }

/* ---------- 卡片 / 指标 ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.card .k { color: var(--ink-3); font-size: 12.5px; }
.card .v { font-size: 23px; font-weight: 650; margin-top: 4px; letter-spacing: -0.5px; }
.card .u { font-size: 13px; font-weight: 400; color: var(--ink-3); margin-left: 2px; }
.card .hint { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.panel-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.panel-body { padding: 14px 16px; }
.panel-body.tight { padding: 0; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th {
  background: #fafbfd;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 12.5px;
  position: sticky;
  top: 0;
}
tbody tr:hover { background: #fafcfb; }
td.wrap { white-space: normal; min-width: 180px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 32px; text-align: center; color: var(--ink-3); }

/* ---------- 徽标 ---------- */
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 19px;
  background: #f1f3f7;
  color: var(--ink-2);
}
.tag.ok { background: var(--brand-soft); color: var(--brand); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.info { background: var(--info-soft); color: var(--info); }

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.toolbar .input, .toolbar select { height: 34px; width: auto; min-width: 120px; }
.spacer { flex: 1; }

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 13px;
}

/* ---------- 趋势条 ---------- */
.trend { display: flex; align-items: flex-end; gap: 10px; height: 120px; padding: 6px 2px 0; }
.trend .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; justify-content: flex-end; height: 100%; }
.trend .bar {
  width: 100%;
  max-width: 46px;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  border-radius: 5px 5px 0 0;
  min-height: 3px;
}
.trend .bar-label { font-size: 11.5px; color: var(--ink-3); }
.trend .bar-val { font-size: 11.5px; color: var(--ink-2); }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 86vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .26);
}
.modal.wide { max-width: 620px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 16px 18px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
}
.close-x {
  border: 0; background: transparent; font-size: 20px; line-height: 1;
  color: var(--ink-3); padding: 0 4px;
}

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  background: #16342a;
  color: #fff;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  z-index: 200;
  opacity: 0;
  transition: opacity .2s, top .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; top: 26px; }
.toast.err { background: var(--danger); }

.note {
  background: var(--warn-soft);
  border: 1px solid #f3e3bd;
  color: #7a5b12;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  margin-bottom: 14px;
}

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

.danger-text { color: var(--danger); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.loading { padding: 30px; text-align: center; color: var(--ink-3); }

@media (max-width: 820px) {
  .sidebar { position: fixed; left: -220px; transition: left .2s; z-index: 50; }
  .sidebar.open { left: 0; }
  .content { padding: 14px; }
  .topbar { padding: 0 14px; }
}
