:root {
  --bg: #f6f9fc;
  --card: #ffffff;
  --line: #eef2f6;
  --txt: #3a4452;
  --sub: #9aa4b2;
  --ok: #5fc69a;
  --fail: #f0928f;
  --pending: #f2c879;
  --accent: #7fb0e0;
  --accent-deep: #5b94d6;
  --accent-soft: #eef5fc;
  --shadow: 0 2px 12px rgba(120,140,170,.08);
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

/* 宽屏：整页视口高度，不出现页面级滚动；成员区/日历在各自框内滚动 */
@media (min-width: 760px) {
  body { display: flex; flex-direction: column; overflow: hidden; }
}

.topbar {
  background: linear-gradient(120deg, #8fc3e8, #7fb0e0 55%, #9bbef0);
  color: #fff;
  padding: 13px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 { font-size: 17px; font-weight: 600; letter-spacing: .5px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar .today { font-size: 13px; opacity: .92; font-weight: 500; }
.topbar .btn-link {
  color: #fff; background: rgba(255,255,255,.15);
  padding: 6px 14px; border-radius: 6px; font-size: 13px; font-weight: 500;
  border: 1px solid rgba(255,255,255,.25);
  transition: background .15s, border-color .15s;
}
.topbar .btn-link:hover {
  background: rgba(255,255,255,.25);
  border-color: rgba(255,255,255,.4);
  text-decoration: none;
}

/* 登录弹窗：默认隐藏，点"登录"按钮显示 */
.login-mask {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.5); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
/* 确保 hidden 属性覆盖 display:flex */
.login-mask[hidden] { display: none; }
.login-box {
  background: var(--card); border-radius: 16px; padding: 28px 32px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); width: 320px;
}
.login-box h2 { margin: 0 0 20px; font-size: 19px; text-align: center; }
.login-box input {
  width: 100%; padding: 10px 12px; margin-bottom: 12px;
  border: 1.5px solid var(--line); border-radius: 8px; font-size: 14px;
}
.login-box input:focus { outline: none; border-color: var(--accent); }
.login-err { color: var(--fail); font-size: 13px; margin: 8px 0; text-align: center; min-height: 18px; }

/* 按钮 */
.btn-primary, .btn-danger, .btn-link {
  padding: 10px 18px; border: none; border-radius: 8px; font-size: 14px; cursor: pointer;
  font-weight: 600; transition: background .12s;
}
.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--accent-deep); }
.btn-danger { background: var(--fail); color: #fff; }
.btn-danger:hover { background: #d8403c; }
.btn-link { background: transparent; color: var(--accent); padding: 8px 0; }
.btn-link:hover { text-decoration: underline; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* 标签页 */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tab {
  flex: 1; padding: 8px 12px; border: none; background: #f0f3f7; color: var(--sub);
  border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .12s, color .12s;
}
.tab.active { background: var(--accent); color: #fff; }
.tab:hover:not(.active) { background: #e6eaf0; }

/* 总览：独立一块，与下方布局留足间距，避免重叠 */
.overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  align-self: center;
  padding: 16px 14px 0;
}
@media (max-width: 600px) {
  .overview {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}
.stat {
  background: var(--card);
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat .num { display: block; font-size: 23px; font-weight: 700; line-height: 1.1; }
.stat .lbl { font-size: 11px; color: var(--sub); margin-top: 3px; }
.stat-ok .num { color: var(--ok); }
.stat-fail .num { color: var(--fail); }
.stat-pending .num { color: var(--pending); }
.stat-total .num { color: var(--accent-deep); }

main { max-width: 980px; margin: 0 auto; padding: 20px 14px 0; width: 100%; align-self: center; }

@media (min-width: 760px) {
  main { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: 14px; }
}

.sec-title { font-size: 13px; font-weight: 600; color: var(--sub); margin: 16px 2px 9px; }
.sec-title .count { color: var(--sub); font-weight: 400; }

/* 两栏：左成员 + 右日历；窄屏堆叠。不用 sticky，避免与上方卡片重叠 */
.layout { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 760px) {
  .layout { grid-template-columns: 320px 1fr; flex: 1; min-height: 0; align-items: stretch; }
  .left { display: flex; flex-direction: column; min-height: 0; }
  .right { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
  .right .calendar { flex: 1; }
}

.search {
  width: 100%;
  font-size: 14px;
  padding: 9px 13px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: var(--card);
  color: var(--txt);
  margin-bottom: 10px;
  outline: none;
}
.search:focus { border-color: var(--accent); }

/* 成员/黑名单列表容器 */
.members, .blacklist {
  display: flex; flex-direction: column; gap: 7px;
  overflow-y: auto;
  padding: 2px 6px 2px 2px;
  margin-right: -4px;
}
.members[hidden], .blacklist[hidden] { display: none; }
@media (min-width: 760px) {
  .members, .blacklist { flex: 1; min-height: 0; }
}
.members::-webkit-scrollbar, .blacklist::-webkit-scrollbar { width: 7px; }
.members::-webkit-scrollbar-thumb, .blacklist::-webkit-scrollbar-thumb { background: #d3dbe4; border-radius: 4px; }
.members::-webkit-scrollbar-thumb:hover, .blacklist::-webkit-scrollbar-thumb:hover { background: #bcc6d2; }

.member {
  display: flex; align-items: center; gap: 8px;
  background: var(--card);
  border: 1.5px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
}
.member.active { border-color: var(--accent); background: var(--accent-soft); }

.m-card {
  flex: 1; display: flex; align-items: center; gap: 11px;
  background: transparent; border: none; padding: 0; cursor: pointer;
  font: inherit; text-align: left; min-width: 0;
  transition: opacity .12s;
}
.m-card:hover { opacity: .8; }

.bl-btns { display: flex; gap: 6px; }

.m-ava {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #a7d0ef, #7fb0e0);
  color: #fff; font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.m-main { flex: 1; min-width: 0; }
.m-top { display: flex; align-items: center; gap: 7px; }
.m-name {
  font-size: 14.5px; font-weight: 600; color: var(--txt);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.m-badge { flex: none; font-size: 10.5px; padding: 2px 9px; border-radius: 20px; color: #fff; }
.m-badge.d-ok { background: var(--ok); }
.m-badge.d-fail { background: var(--fail); }
.m-badge.d-pending, .m-badge.d-none { background: var(--pending); }

.m-strip { display: flex; gap: 3px; margin-top: 6px; }
.m-time { display: block; font-size: 11px; color: var(--sub); margin-top: 5px; }
.m-time.done { color: var(--ok); font-weight: 600; }
.tick { width: 100%; max-width: 18px; height: 5px; border-radius: 3px; background: #eaeef3; }
.tick.d-ok { background: var(--ok); }
.tick.d-fail { background: var(--fail); }
.tick.d-pending { background: var(--pending); }
.tick.d-none { background: #eaeef3; }

.m-count { flex: none; font-size: 11px; color: var(--sub); text-align: right; white-space: nowrap; }
.m-count b { color: var(--ok); font-size: 13px; }
.m-count b.f { color: var(--fail); }

/* 日历卡（右栏） */
.usercard { background: var(--card); border-radius: 16px; padding: 18px 18px 20px; box-shadow: var(--shadow); }
@media (min-width: 760px) {
  .right .usercard {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column;
    padding: 16px 18px;
  }
  .right .uc-head { margin-bottom: 10px; }
  .right .cal-nav { margin: 0 2px 8px; }
  .right .legend { margin-top: 10px; padding-top: 10px; }
}
.uc-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.uc-name { font-size: 18px; font-weight: 700; }
.uc-stats { display: flex; gap: 8px; }
.chip { font-size: 12px; padding: 4px 11px; border-radius: 20px; }
.chip-ok { background: #e9f7f1; color: #3aa379; }
.chip-fail { background: #fdeeed; color: #db7470; }

/* 黑名单提示条 */
.blacklist-alert {
  background: #fff3cd;
  border: 1.5px solid #ffc107;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #856404;
  text-align: center;
}
.blacklist-alert[hidden] { display: none; }

.cal-nav { display: flex; align-items: center; justify-content: space-between; margin: 2px 2px 14px; }
.cal-title { font-size: 16px; font-weight: 700; }
.navbtn {
  width: 34px; height: 34px; border-radius: 10px;
  border: none; background: var(--accent-soft);
  font-size: 19px; line-height: 1; color: var(--accent-deep); cursor: pointer;
  transition: background .12s;
}
.navbtn:disabled { color: #d2dae3; background: #f4f6f9; cursor: not-allowed; }
.navbtn:not(:disabled):hover { background: #e2eef9; }
.cal-loading { text-align: center; color: var(--sub); padding: 30px 0; }

/* 日历：圆形日戳 */
.calendar { width: 100%; border-collapse: collapse; table-layout: fixed; }
.calendar th { font-size: 12px; font-weight: 500; color: var(--sub); padding: 0 0 8px; text-align: center; }
.calendar th.sun { color: #e6a0bd; }
.calendar td { text-align: center; padding: 4px 0; }
.calendar td.blank { background: transparent; }
@media (min-width: 760px) {
  /* 一屏布局：行均匀分布填满高度，日戳不超出 */
  .right .calendar tbody { }
  .right .calendar td { padding: 0; }
}

.stamp {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 14px; font-weight: 600; color: var(--sub);
}
.stamp.d-ok { background: var(--ok); color: #fff; }
.stamp.d-fail { background: var(--fail); color: #fff; }
.stamp.d-pending { color: #d9a441; box-shadow: inset 0 0 0 2px var(--pending); }
.stamp.d-none { color: #cdd4dd; }
.cell.is-today .stamp { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 图例 */
.legend {
  display: flex; flex-wrap: wrap; gap: 16px;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--sub);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 13px; height: 13px; border-radius: 50%; display: inline-block; }
.dot.d-ok { background: var(--ok); }
.dot.d-fail { background: var(--fail); }
.dot.d-pending { box-shadow: inset 0 0 0 2px var(--pending); }
.dot.d-none { background: #e3e8ee; }

.empty { text-align: center; color: var(--sub); padding: 30px 0; }
.foot { text-align: center; font-size: 12px; color: var(--sub); margin-top: 22px; }

@media (max-width: 420px) {
  .stamp { width: 34px; height: 34px; font-size: 13px; }
}



/* Toast 提示 */
.toast {
  position: fixed;
  top: 80px;
  right: 20px;
  background: #323232;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s, transform 0.3s;
  z-index: 10000;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
