:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --line: #e8eaf0;
  --text: #2c3038;
  --muted: #9aa0ad;
  --primary: #3b7cff;
  --primary-weak: #eef4ff;
  --danger: #e5484d;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e8f0ff 0%, #f5f6fa 60%);
}
.login-card {
  width: 340px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 30px;
  box-shadow: 0 12px 40px rgba(60, 90, 160, .10);
  text-align: center;
}
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); margin-bottom: 24px; font-size: 13px; }
.login-card input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  outline: none;
}
.login-card input:focus { border-color: var(--primary); }
.err { color: var(--danger); font-size: 12px; min-height: 18px; margin-top: 8px; }

/* ---------- 顶栏 / 工具条 ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; font-size: 16px; }
.userbox { display: flex; align-items: center; gap: 10px; color: var(--muted); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 20px 6px;
}
.tabs { display: flex; gap: 8px; }
.tab {
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}
.tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 500;
}
.cal-nav { display: flex; align-items: center; gap: 8px; }
.month-title { font-weight: 600; font-size: 16px; min-width: 92px; text-align: center; }
.toolbar .right { margin-left: auto; display: flex; gap: 8px; }

.legend { display: flex; gap: 8px; padding: 4px 20px 10px; flex-wrap: wrap; }
.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #fff;
}
.chip.ship { background: #e5484d; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.danger-text { color: var(--danger); }

/* ---------- 日历 ---------- */
.calendar {
  margin: 0 20px 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head { border-bottom: 1px solid var(--line); background: #fafbfd; }
.cal-head div {
  padding: 10px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.cal-cell {
  min-height: 108px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
  cursor: pointer;
  position: relative;
  transition: background .12s;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: var(--primary-weak); }
.cal-cell.other { background: #fafbfd; }
.cal-cell.other .d-num { color: #cdd2dc; }
.cal-cell.other .d-lunar { color: #dfe3ea; }
.cal-cell.today .d-num {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
}
.d-top { display: flex; align-items: baseline; gap: 6px; }
.d-num { font-size: 16px; font-weight: 600; width: 24px; height: 24px; line-height: 24px; text-align: center; }
.d-lunar { font-size: 11px; color: var(--muted); }
.d-lunar.festival { color: #e5484d; }
.d-items { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.d-item {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.d-item .fa {
  display: inline-block;
  background: rgba(255, 255, 255, .92);
  color: #e5484d;
  font-weight: 700;
  border-radius: 3px;
  font-size: 10px;
  padding: 0 3px;
  margin-right: 3px;
  line-height: 14px;
}
.d-item .nm { opacity: .92; margin-right: 4px; }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 34, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal {
  width: 500px;
  max-width: 100%;
  max-height: 86dvh;
  overflow: auto;
  background: var(--card);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
}
.modal.small { width: 380px; }
.modal.wide { width: 580px; }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.day-title { font-size: 17px; font-weight: 600; }
.day-lunar { font-size: 12px; color: var(--muted); margin-top: 2px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}
.tip { font-size: 12px; color: var(--muted); }

.day-list { display: flex; flex-direction: column; gap: 10px; }
.day-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.day-row .name { font-weight: 500; display: flex; align-items: center; gap: 6px; }
.tag-ship {
  font-size: 10px;
  background: #e5484d;
  color: #fff;
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 700;
}
.shift-pick { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.shift-opt {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}
.shift-opt.sel { background: var(--primary); border-color: var(--primary); color: #fff; }
.slot-input { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.slot-input input[type="time"] {
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
}

/* ---------- 身份管理 ---------- */
.staff-filter { margin-bottom: 10px; }
.staff-filter input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}
.staff-list { display: flex; flex-direction: column; gap: 8px; max-height: 46dvh; overflow: auto; }
.staff-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.staff-row .name { font-weight: 500; min-width: 76px; }
.staff-row .acc { color: var(--muted); font-size: 12px; min-width: 84px; }
.staff-row .roles { color: var(--muted); font-size: 12px; flex: 1; }
.staff-row select {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}
.staff-row .ship-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

/* ---------- 班次设置 ---------- */
.types-list { display: flex; flex-direction: column; gap: 8px; }
.types-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.types-row input[type="text"] {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
}
.types-row input[type="color"] {
  width: 36px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px;
  cursor: pointer;
  background: #fff;
}
.types-row label.tm {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

/* ---------- 小组 / 直播间（v4） ---------- */
.group-head {
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  padding: 12px 2px 4px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 4px;
}
.tag-leader {
  font-size: 10px;
  background: #16a34a;
  color: #fff;
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 700;
}
.room-line { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.room-line label { font-size: 13px; color: var(--muted); white-space: nowrap; }
.room-sel {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  flex: 1;
  background: #fff;
}
.groups-list { display: flex; flex-direction: column; gap: 12px; }
.group-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.group-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.group-card-head input[type="text"] {
  flex: 1;
  min-width: 120px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
}
.group-card-head select {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 6px 10px;
}
.member-opt {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

/* ---------- 换班申请 ---------- */
.swap-form { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.swap-grid {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 8px 10px;
  align-items: center;
  margin-bottom: 10px;
}
.swap-grid label { font-size: 13px; color: var(--muted); }
.swap-grid select, .swap-form select {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  width: 100%;
}
.swap-list { display: flex; flex-direction: column; gap: 8px; max-height: 40dvh; overflow: auto; }
.swap-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  flex-wrap: wrap;
}
.swap-row .sw-desc { flex: 1; min-width: 220px; }
.swap-row .sw-status { font-size: 12px; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.sw-status.pending { background: #fff7e6; color: #d48806; }
.sw-status.approved { background: #eef4ff; color: #3b7cff; }
.sw-status.confirmed { background: #e8f8f0; color: #16a34a; }
.sw-status.rejected { background: #fdecec; color: #e5484d; }

.copy-body { display: flex; flex-direction: column; gap: 8px; }
.copy-body label { font-size: 13px; color: var(--muted); }
.copy-body input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%);
  background: rgba(28, 32, 42, .92);
  color: #fff;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 200;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .cal-cell { min-height: 84px; padding: 4px 5px; }
  .d-num { font-size: 14px; }
  .d-lunar { display: none; }
  .d-item { font-size: 10px; padding: 1px 5px; }
  .toolbar { padding: 10px 12px 4px; gap: 8px; }
  .calendar { margin: 0 12px 16px; }
  .legend { padding: 2px 12px 8px; }
  .toolbar .right { width: 100%; margin-left: 0; }
  .day-row { grid-template-columns: 84px 1fr; }
}
