/* ==========================================================
   星剧 · 团队管理页
   依赖 styles.css（基础组件）+ theme-film.css（暖调变量）
   ========================================================== */

/* ---------- 概览卡片 ---------- */
.tm-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.tm-stat {
  background: #fdfcfa;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tm-stat__label {
  font-size: 13.5px;
  color: var(--text-3);
  letter-spacing: .2px;
}
.tm-stat__value {
  font-size: 23.5px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tm-stat__value small {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-3);
  margin-left: 3px;
}
.tm-stat--accent .tm-stat__value { color: #9a7c43; }

/* ---------- 成员表格 ---------- */
.tm-table th { background: #f2ede2; }
.tm-table td { vertical-align: middle; }
.tm-table tbody tr:hover { background: #f7f3ea; }

.tm-member { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tm-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
}
.tm-avatar--you { position: relative; }
.tm-avatar--you::after {
  content: '';
  position: absolute;
  right: -1px; bottom: -1px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid #fdfcfa;
}
.tm-member__txt { min-width: 0; }
.tm-member__name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tm-member__handle {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 1px;
}

.tm-email,
.tm-acc {
  color: var(--text-2);
  font-size: 14px;
  letter-spacing: .1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}
/* 登录账号：等宽字体，方便核对字符 */
.tm-acc {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  letter-spacing: .2px;
  color: var(--text);
}

/* 角色下拉：平时像文字，悬停才显出可编辑 */
.tm-role {
  height: 32px;
  max-width: 124px;
  padding: 0 26px 0 9px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23877c6b' stroke-width='1.8'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 6px center / 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  appearance: none;
  cursor: pointer;
  transition: border-color .14s, background-color .14s;
}
.tm-role:hover { border-color: var(--border-2); background-color: #fff; }
.tm-role:focus {
  outline: none;
  border-color: var(--accent);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(201, 169, 110, .16);
}
.tm-role--admin { color: #8a6a2f; font-weight: 500; }

/* 负责项目 */
.tm-proj {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  font-size: 14px;
  color: var(--text-2);
  border: none;
  background: none;
  padding: 3px 6px;
  margin-left: -6px;
  border-radius: 6px;
  text-align: left;
  transition: background-color .14s, color .14s;
}
.tm-proj:hover { background: #f2ede2; color: var(--text); }
.tm-proj__n {
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: #8a6a2f;
  font-size: 13px;
  font-weight: 600;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.tm-proj__txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tm-proj--empty { color: var(--text-3); cursor: default; }
.tm-proj--empty:hover { background: none; color: var(--text-3); }

/* 状态 */
.tm-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 13px;
  line-height: 1;
  white-space: nowrap;
  font-size: 13px;
  letter-spacing: .2px;
}
.tm-status::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.tm-status--active { background: var(--green-soft); color: #4a6b3c; }
.tm-status--pending { background: #f3e8d2; color: #8a6a2f; }
/* 可点击的状态徽标（待接受 → 模拟接受邀请） */
button.tm-status--btn { border: none; font-family: inherit; }
button.tm-status--pending { cursor: pointer; transition: box-shadow .15s, transform .15s; }
button.tm-status--pending:hover { box-shadow: 0 0 0 2px rgba(138, 106, 47, .25); transform: translateY(-1px); }

/* 操作 */
.tm-act {
  border: none;
  background: none;
  padding: 5px 8px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-2);
  transition: background-color .14s, color .14s;
}
.tm-act:hover { background: #f4e4e1; color: var(--danger); }

/* 空态与表格容器间距 */
.tm-table + * { margin-top: 0; }

/* ---------- 弹窗补充 ---------- */
.modal--sm { width: 380px; }
.tm-confirm {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text-2);
}
.tm-confirm b { color: var(--text); font-weight: 600; }
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #8d322a; border-color: #8d322a; }

/* 邀请弹窗里的提示沿用 .am-hint（settings.css 未在此页加载，此处补齐） */
.am-hint {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-3);
}

@media (max-width: 1180px) {
  .tm-stats { grid-template-columns: repeat(2, 1fr); }
  .tm-email,
  .tm-acc { max-width: 150px; }
}

/* 邀请表单里密码标签的必填星号 */
.pass-req { color: var(--danger); font-style: normal; margin-left: 2px; }

/* 邀请弹窗里把密码框对齐成与普通输入框同一套尺寸（styles.css 的 .pass-input 是 40px / 9px 圆角） */
#inviteModal .pass-field { margin-bottom: 14px; }
#inviteModal .pass-field__l { font-size: 14px; margin-bottom: 6px; }
#inviteModal .pass-input { height: 36px; border-radius: var(--radius); }
#inviteModal .pass-input input { font-size: 14.5px; }
#inviteModal .pass-err { margin-top: 6px; }
/* theme-film 的 .field input:focus 会把边框刷成金色，这里让错误态在聚焦时也保持红色 */
#inviteModal .field input.err,
#inviteModal .field input.err:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(160, 59, 50, .12);
}

/* ==========================================================
   进入团队管理：暗口令闸门
   ========================================================== */
/* 未验证时不渲染页面内容（避免成员名单在口令前露出） */
body.is-locked .app { visibility: hidden; }

.tm-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(120% 90% at 50% 0%, #fbf7ef 0%, #f4eee2 55%, #efe7d8 100%);
  animation: tmFade .18s ease;
}
.tm-gate[hidden] { display: none; }
@keyframes tmFade { from { opacity: 0; } to { opacity: 1; } }

.tm-gate__card {
  width: 384px;
  max-width: 100%;
  padding: 26px 24px 18px;
  border-radius: 18px;
  background: #fffdfa;
  border: 1px solid #ece0cb;
  box-shadow: 0 26px 60px -34px rgba(43, 38, 32, .55);
  text-align: center;
  animation: tmRise .24s cubic-bezier(.2, .9, .3, 1);
}
@keyframes tmRise { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }

.tm-gate__ico {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  margin: 0 auto 13px;
  border-radius: 14px;
  background: linear-gradient(150deg, #fdf2da, #f2e0bc);
  border: 1px solid #e6d3ae;
  color: #96743a;
}
.tm-gate__ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.tm-gate__t {
  margin: 0;
  font-family: Georgia, "Songti SC", "STSong", "SimSun", serif;
  font-size: 17.5px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--text);
}
.tm-gate__s {
  margin: 7px 0 16px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-3);
}

.tm-gate__field { position: relative; }
.tm-gate__field input {
  width: 100%;
  height: 42px;
  padding: 0 40px 0 13px;
  border: 1px solid #e0d6c4;
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--text);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.tm-gate__field input::placeholder { letter-spacing: .3px; color: #b6ae9f; }
.tm-gate__field input:focus { border-color: #c9a96e; box-shadow: 0 0 0 3px rgba(201, 169, 110, .16); }
.tm-gate__field input.is-err {
  border-color: rgba(160, 59, 50, .62);
  box-shadow: 0 0 0 3px rgba(160, 59, 50, .1);
  animation: shake .25s;
}

.tm-gate__eye {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  transition: background-color .14s, color .14s;
}
.tm-gate__eye svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.tm-gate__eye:hover { background: #f4eee3; color: var(--text-2); }
.tm-gate__eye.is-on { color: #a3843f; }

.tm-gate__err {
  display: block;
  min-height: 17px;
  margin: 6px 2px 4px;
  font-size: 12px;
  font-style: normal;
  text-align: left;
  color: #a03b32;
}

.tm-gate__go {
  width: 100%;
  height: 40px;
  border: 1px solid var(--primary);
  border-radius: 10px;
  background: var(--primary);
  color: #f7f1e5;
  font-family: inherit;
  font-size: 13.5px;
  letter-spacing: .8px;
  cursor: pointer;
  transition: background .18s, transform .12s;
}
.tm-gate__go:hover { background: var(--primary-hover); }
.tm-gate__go:active { transform: translateY(1px); }

.tm-gate__back {
  display: inline-block;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-3);
  text-decoration: none;
}
.tm-gate__back:hover { color: var(--text-2); text-decoration: underline; }

@media (max-width: 480px) {
  .tm-gate__card { padding: 22px 18px 16px; }
  .tm-gate__s { font-size: 12px; }
}
