/* =============================================================
   健身房管理系统 · 管理后台样式（对标阿懒健身 Alan Fit）
   设计规范来源：阿懒前端主包采集
     - 中文字体栈：PingFang SC → Microsoft YaHei → Helvetica Neue → Roboto Medium
     - 数字/报表字体：DIN Condensed / Arial Narrow（紧凑等宽）
     - 组件风格：Angular Material (MDC) — 卡片 / 表格 / 对话框 / Snackbar
   ============================================================= */

:root {
  /* 品牌与语义色 */
  --c-primary: #1e88e5;
  --c-primary-dark: #1565c0;
  --c-primary-soft: #e8f2fe;
  --c-accent: #00acc1;
  --c-success: #22a06b;
  --c-success-soft: #e6f6ef;
  --c-warn: #f5a623;
  --c-warn-soft: #fff4e0;
  --c-danger: #e5533d;
  --c-danger-soft: #fdeceb;
  --c-info: #7a5af8;
  --c-info-soft: #f0ecfe;

  /* 中性色 */
  --c-sidebar: #1f2937;
  --c-sidebar-hover: #2c3a4b;
  --c-sidebar-active: #1e88e5;
  --c-bg: #f0f2f5;
  --c-card: #ffffff;
  --c-border: #e3e6eb;
  --c-border-soft: #eef0f3;
  --c-text: #212b36;
  --c-text-sub: #5c6b7a;
  --c-text-mute: #98a2b3;

  /* 字体 */
  --font-cn: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", "Roboto-Medium", "SFUIDisplay", sans-serif;
  --font-num: "DIN Condensed", "DIN Alternate", "Arial Narrow", "Helvetica Neue", sans-serif;

  /* 尺寸 */
  --sidebar-w: 216px;
  --topbar-h: 56px;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-pop: 0 8px 28px rgba(16, 24, 40, .16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-cn);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.num { font-family: var(--font-num); font-weight: 700; letter-spacing: .3px; }

/* ============ 布局骨架 ============ */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ---- 左侧导航 ---- */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--c-sidebar);
  color: #e4e8ee;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar-brand {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand .logo {
  width: 28px; height: 28px; border-radius: 6px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px;
}
.sidebar-brand .name { font-size: 15px; font-weight: 600; letter-spacing: .5px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0 24px; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 3px; }

.nav-group-title {
  padding: 12px 16px 6px;
  font-size: 11px; color: #8a97a8; letter-spacing: 1px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; margin: 1px 8px; border-radius: var(--radius-sm);
  color: #cbd3dd; cursor: pointer; font-size: 13.5px;
  transition: background .15s, color .15s;
  user-select: none;
}
.nav-item:hover { background: var(--c-sidebar-hover); color: #fff; }
.nav-item.active { background: var(--c-sidebar-active); color: #fff; font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; opacity: .9; }
.nav-item .txt { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .badge {
  background: var(--c-danger); color: #fff; font-size: 10px;
  padding: 1px 6px; border-radius: 9px; font-family: var(--font-num);
}

/* ---- 右侧主体 ---- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  background: #fff; border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; box-shadow: 0 1px 2px rgba(16,24,40,.03);
  z-index: 5;
}
.topbar .crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--c-text-sub); }
.topbar .crumbs b { color: var(--c-text); font-size: 15px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--c-text-sub); }
.topbar-right .store { display: flex; align-items: center; gap: 6px; }
.topbar-right .user {
  display: flex; align-items: center; gap: 7px;
  padding-left: 14px; border-left: 1px solid var(--c-border);
}
.topbar-right .avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--c-primary-soft);
  color: var(--c-primary-dark); display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px;
}

.content { flex: 1; overflow-y: auto; padding: 16px 20px 32px; }
.content::-webkit-scrollbar { width: 8px; }
.content::-webkit-scrollbar-thumb { background: #d5dae1; border-radius: 4px; }

/* ============ 通用组件 ============ */
.page-head { margin-bottom: 14px; }
.page-head h2 { margin: 0 0 4px; font-size: 19px; font-weight: 600; }
.page-head .desc { color: var(--c-text-mute); font-size: 12.5px; }

.card {
  background: var(--c-card); border-radius: var(--radius);
  box-shadow: var(--shadow-card); border: 1px solid var(--c-border-soft);
  margin-bottom: 14px; overflow: hidden;
}
.card-head {
  padding: 13px 16px; border-bottom: 1px solid var(--c-border-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head .sub { color: var(--c-text-mute); font-size: 12px; font-weight: 400; }
.card-body { padding: 14px 16px; }
.card-body.flush { padding: 0; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat {
  background: var(--c-card); border: 1px solid var(--c-border-soft);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-card);
  display: flex; align-items: center; justify-content: space-between;
}
.stat .label { font-size: 12.5px; color: var(--c-text-sub); margin-bottom: 4px; }
.stat .value { font-family: var(--font-num); font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat .unit { font-size: 12px; color: var(--c-text-mute); margin-left: 3px; font-family: var(--font-cn); font-weight: 400; }
.stat .ico-wrap {
  width: 40px; height: 40px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; font-size: 19px;
}
.stat .trend { font-size: 11.5px; margin-top: 3px; }
.stat .trend.up { color: var(--c-success); }
.stat .trend.down { color: var(--c-danger); }

/* 工具栏 */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--c-border-soft); background: #fbfcfd;
}
.toolbar .spacer { flex: 1; }
.toolbar .filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 表单控件 */
.inp, .sel {
  height: 32px; padding: 0 10px; border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  background: #fff; font-size: 13px; font-family: var(--font-cn); color: var(--c-text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.inp:focus, .sel:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(30,136,229,.12); }
.inp::placeholder { color: #b6bec9; }
.sel { cursor: pointer; }
textarea.inp { height: auto; padding: 8px 10px; resize: vertical; min-height: 64px; line-height: 1.5; }
label.fl { font-size: 12.5px; color: var(--c-text-sub); margin-bottom: 4px; display: block; }
.frow { margin-bottom: 12px; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* 按钮 */
.btn {
  height: 32px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--c-border);
  background: #fff; color: var(--c-text); font-size: 13px; font-family: var(--font-cn);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn.primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); color: #fff; }
.btn.danger { color: var(--c-danger); border-color: #f3c9c4; }
.btn.danger:hover { background: var(--c-danger-soft); border-color: var(--c-danger); color: var(--c-danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--c-text-sub); padding: 0 8px; }
.btn.ghost:hover { background: #eef1f5; color: var(--c-text); border-color: transparent; }
.btn.sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn.lg { height: 38px; padding: 0 20px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 表格 */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  background: #fafbfc; text-align: left; padding: 10px 12px; font-weight: 600;
  color: var(--c-text-sub); border-bottom: 1px solid var(--c-border); white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
table.tbl td {
  padding: 10px 12px; border-bottom: 1px solid var(--c-border-soft); vertical-align: middle;
}
table.tbl tbody tr:hover { background: #f8fafc; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.right, table.tbl th.right { text-align: right; }
table.tbl td.center, table.tbl th.center { text-align: center; }
table.tbl .ops { display: flex; gap: 4px; flex-wrap: wrap; }
.link { color: var(--c-primary); cursor: pointer; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--c-danger); }
.nowrap { white-space: nowrap; }
.money {
  font-family: var(--font-num); font-weight: 700;
}
.money::before { content: "¥"; font-size: 11px; margin-right: 1px; font-weight: 500; }

/* 徽标 / 状态 */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11.5px;
  line-height: 1.6; white-space: nowrap;
}
.tag.gray   { background: #f0f2f5; color: #5c6b7a; }
.tag.blue   { background: var(--c-primary-soft); color: var(--c-primary-dark); }
.tag.green  { background: var(--c-success-soft); color: #17814f; }
.tag.orange { background: var(--c-warn-soft); color: #b3730a; }
.tag.red    { background: var(--c-danger-soft); color: #c03a28; }
.tag.purple { background: var(--c-info-soft); color: #5c3fd0; }

/* 分节 tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--c-border); margin-bottom: 12px; }
.tab {
  padding: 8px 16px; cursor: pointer; font-size: 13.5px; color: var(--c-text-sub);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s;
}
.tab:hover { color: var(--c-primary); }
.tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 600; }

/* 空状态 */
.empty { padding: 48px 16px; text-align: center; color: var(--c-text-mute); }
.empty .big { font-size: 34px; opacity: .35; margin-bottom: 8px; }
.loading { padding: 40px; text-align: center; color: var(--c-text-mute); }

/* 对话框 */
.mask {
  position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .15s ease;
}
.dlg {
  background: #fff; border-radius: 10px; box-shadow: var(--shadow-pop);
  width: 520px; max-width: calc(100vw - 32px); max-height: 88vh;
  display: flex; flex-direction: column; animation: popIn .18s ease;
}
.dlg.wide { width: 760px; }
.dlg.narrow { width: 400px; }
.dlg-head {
  padding: 16px 20px; border-bottom: 1px solid var(--c-border-soft);
  display: flex; align-items: center; justify-content: space-between;
}
.dlg-head h4 { margin: 0; font-size: 15.5px; font-weight: 600; }
.dlg-close { cursor: pointer; color: var(--c-text-mute); font-size: 20px; line-height: 1; padding: 0 4px; }
.dlg-close:hover { color: var(--c-text); }
.dlg-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.dlg-foot {
  padding: 12px 20px; border-top: 1px solid var(--c-border-soft);
  display: flex; justify-content: flex-end; gap: 8px;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { from { opacity: 0; transform: translateY(-8px) scale(.98) } to { opacity: 1; transform: none } }

/* Snackbar 提示 */
.toast-box {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: #32363f; color: #fff; padding: 10px 18px; border-radius: 6px;
  font-size: 13.5px; box-shadow: var(--shadow-pop); animation: slideUp .2s ease;
  display: flex; align-items: center; gap: 8px;
}
.toast.ok { background: #1f8a5b; }
.toast.err { background: #c93d27; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }

/* 详情信息栅格 */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; }
.kv { border-bottom: 1px dashed var(--c-border-soft); padding-bottom: 8px; }
.kv .k { font-size: 12px; color: var(--c-text-mute); margin-bottom: 2px; }
.kv .v { font-size: 13.5px; }

/* 时间线（跟进记录 / 操作流水） */
.timeline { position: relative; padding-left: 18px; }
.timeline::before {
  content: ""; position: absolute; left: 4px; top: 4px; bottom: 4px;
  width: 2px; background: var(--c-border);
}
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before {
  content: ""; position: absolute; left: -18px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--c-primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--c-primary-soft);
}
.tl-item .tl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.tl-item .tl-time { font-size: 11.5px; color: var(--c-text-mute); font-family: var(--font-num); }
.tl-item .tl-title { font-size: 13.5px; font-weight: 600; }
.tl-item .tl-body { font-size: 13px; color: var(--c-text-sub); }

/* 分页 */
.pager {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--c-border-soft); font-size: 13px;
  color: var(--c-text-sub);
}
.pager .pgbtn {
  min-width: 28px; height: 28px; padding: 0 6px; border: 1px solid var(--c-border);
  background: #fff; border-radius: 4px; cursor: pointer; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.pager .pgbtn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.pager .pgbtn.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.pager .pgbtn:disabled { opacity: .4; cursor: not-allowed; }

/* 进度条 */
.bar { height: 6px; background: #eef0f3; border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--c-primary); border-radius: 3px; }

/* 工具类 */
.row-flex { display: flex; align-items: center; gap: 10px; }
.row-flex.wrap { flex-wrap: wrap; }
.mt0 { margin-top: 0; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb0 { margin-bottom: 0; } .mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.txt-sub { color: var(--c-text-sub); }
.txt-mute { color: var(--c-text-mute); }
.txt-danger { color: var(--c-danger); }
.txt-success { color: var(--c-success); }
.txt-right { text-align: right; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* 经营驾驶舱 */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { background: #fff; border: 1px solid #eef0f3; border-radius: 14px; padding: 18px 16px; box-shadow: 0 2px 10px rgba(0,0,0,.03); }
.kpi-t { font-size: 13px; color: #64748b; }
.kpi-v { font-size: 26px; font-weight: 800; color: #1e293b; margin: 6px 0 2px; font-family: var(--font-num); }
.kpi-s { font-size: 12px; color: #94a3b8; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; overflow-x: auto; padding: 8px 0; }
.dbar { flex: 0 0 18px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.dbar-fill { width: 14px; background: linear-gradient(180deg,#3b82f6,#1d4ed8); border-radius: 4px 4px 0 0; min-height: 2px; }
.dbar-x { font-size: 9px; color: #94a3b8; margin-top: 4px; transform: rotate(-45deg); white-space: nowrap; }
