:root {
  font-family: Inter, "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  color: #202b36;
  background: #f5f7f9;
  font-size: 14px;
  --line: #dfe5ea;
  --blue: #285b85;
  --muted: #7b8792;
  --danger: #b62e36;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, .button {
  cursor: pointer; background: #fff; border: 1px solid var(--line); border-radius: 7px;
  padding: 8px 13px; color: #344454; display: inline-block; line-height: 1.2;
}
button:hover, .button:hover { background: #eff4f8; }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid #8bb4d7; outline-offset: 2px;
}
button.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
button.primary:hover { background: #214c70; }
button.danger { color: #a54b48; background: #fff; }
button.danger:hover { background: #fbeeed; }
button.ghost { border: 0; background: transparent; padding: 6px 8px; }
button.small { padding: 5px 9px; font-size: 12px; }
[hidden] { display: none !important; }

/* ---------------- 顶部 ---------------- */
header.topbar {
  min-height: 64px; display: flex; align-items: center; gap: 14px;
  padding: 8px 26px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 11px; margin-right: 4px; }
.brand strong { display: block; font-size: 17px; letter-spacing: .2px; }
.brand small { display: block; color: #7e8992; margin-top: 2px; font-size: 11px; }
.mark {
  background: #254b6a; color: #fff; padding: 9px 11px; border-radius: 9px;
  font-weight: 700; font-size: 16px; line-height: 1;
}
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sync-state { font-size: 11px; color: #7c8b97; min-width: 54px; text-align: center; }
.sync-state.saving { color: #9a6a1c; }
.sync-state.error { color: var(--danger); }
.account { display: flex; align-items: center; gap: 8px; padding-left: 10px; border-left: 1px solid var(--line); }
.account .who { font-size: 12px; color: #526475; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 150px; background: #fff;
  border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 12px 30px #1f354626;
  padding: 6px; display: flex; flex-direction: column; gap: 2px; z-index: 30;
}
.menu-panel button { border: 0; text-align: left; padding: 9px 12px; border-radius: 6px; }
.menu-panel button:hover { background: #eff4f8; }

/* ---------------- 主区 ---------------- */
main { max-width: 1600px; margin: 0 auto; padding: 20px 26px 10px; }
.toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.tabs { display: flex; background: #e9edf1; padding: 4px; border-radius: 8px; gap: 2px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 8px 16px; color: #73808d; border-radius: 6px; }
.tabs button.active { background: #fff; color: #274b68; box-shadow: 0 1px 4px #0001; font-weight: 600; }
.dates { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dates label { display: flex; align-items: center; gap: 8px; color: #71808c; font-size: 12px; }
.dates input { padding: 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #2d3f4f; }
.view-hint { font-size: 11px; color: #84919c; margin: 0 0 14px; line-height: 1.6; }

/* ---------------- 团队与周列 ---------------- */
.team { margin: 0 0 26px; }
.team-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.team-heading h2 { font-size: 19px; margin: 0; }
.team-heading .badge { background: #e4edf4; color: #426989; padding: 4px 8px; border-radius: 5px; font-size: 11px; }
.team-heading .count { color: #85919b; font-size: 12px; }
.team-heading .add-team { margin-left: auto; border: 0; background: transparent; font-size: 12px; color: var(--blue); }
.week-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.week-column {
  background: #edf1f4; border: 1px solid #e0e6ea; border-radius: 10px; min-height: 220px;
  display: flex; flex-direction: column; padding: 11px;
}
.week-column.current { border-top: 3px solid #427ba8; padding-top: 9px; }
.week-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; margin: 1px 2px 9px; }
.week-head strong { font-size: 13px; }
.week-head small { font-size: 11px; color: #80909b; white-space: nowrap; }
.week-date { color: #7c8b97; font-size: 11px; margin-top: 4px; }
.week-badge { background: #dceaf5; color: #2f648e; padding: 2px 6px; border-radius: 4px; font-size: 10px; margin-left: 4px; }
.capacity {
  width: 100%; text-align: left; padding: 8px 9px; background: #f6f8fa;
  border: 1px dashed #cdd6de; margin-bottom: 10px; min-height: 48px;
}
.capacity strong { font-size: 11px; display: block; color: #697e8f; font-weight: 650; }
.capacity span { font-size: 11px; display: block; color: #83919c; margin-top: 4px; line-height: 1.5; overflow-wrap: anywhere; }
.capacity.free { border-color: #a9c9bd; background: #eff7f3; }
.capacity.free strong { color: #43725e; }
.capacity.stale { border-color: #d9b06c; background: #fdf6e8; }
.capacity.stale strong { color: #8a631d; }
.cards { display: flex; flex-direction: column; gap: 9px; }
.empty { padding: 26px 4px; text-align: center; color: #9ba6af; font-size: 12px; line-height: 1.8; }
.add-card { margin-top: 10px; border: 1px dashed #ccd6de; background: transparent; color: #8a98a4; font-size: 12px; }
.add-card:hover { color: var(--blue); }

/* ---------------- 卡片 ---------------- */
.card {
  width: 100%; text-align: left; border: 1px solid #dee4e9; border-radius: 8px; padding: 12px;
  background: #fff; box-shadow: 0 2px 4px #273e5010; transition: transform .15s, box-shadow .15s;
  display: block; color: inherit;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px #273e5018; background: #fff; }
.card-top { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.tag { font-size: 10px; color: #6c7e8c; background: #f0f3f6; border-radius: 4px; padding: 3px 6px; white-space: nowrap; }
.priority {
  display: inline-block; font-size: 11px; font-weight: 750; padding: 4px 8px; border-radius: 5px;
  letter-spacing: .3px; white-space: nowrap;
}
.priority.p0 { background: #b62e36; color: #fff; }
.priority.p1 { background: #fbe6cd; color: #974a04; }
.priority.p2 { background: #d9e9ff; color: #225ba3; }
.priority.p3 { background: #e9edf1; color: #657281; }
.card.priority-p0 { border-left: 5px solid #b62e36; background: #fff9f9; }
.card.priority-p1 { border-left: 5px solid #cf842e; }
.card.priority-p2 { border-left: 5px solid #3877be; }
.card.priority-p3 { border-left: 5px solid #a9b2bc; }
.card h3 { font-size: 13.5px; line-height: 1.5; margin: 9px 0 4px; font-weight: 650; overflow-wrap: anywhere; }
.card h3 small { font-size: 10px; font-weight: 400; color: #7e8a95; margin-left: 2px; }
.description {
  font-size: 12px; color: #7d8993; line-height: 1.55; margin: 0 0 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 18px; overflow-wrap: anywhere;
}
.end-date { font-size: 13.5px; font-weight: 650; color: #364f63; }
.end-date.ending { color: #286c57; }
.end-date.overdue { color: #ad3c3c; }
.end-date.done { color: #6d7780; }
.member-line { display: flex; gap: 4px; flex-wrap: wrap; margin: 10px 0 0; font-size: 11px; color: #526779; }
.member-line span { background: #eff3f6; padding: 3px 6px; border-radius: 4px; max-width: 100%; overflow-wrap: anywhere; }
.member-line span.inactive { color: #8c949c; text-decoration: line-through; }
.card-bottom {
  border-top: 1px solid #edf0f2; padding-top: 8px; margin-top: 9px;
  display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: #86939d;
}
.card-bottom b { white-space: nowrap; color: inherit; }
.card.completed, .card.completed:hover {
  background: #e6e8eb; border-color: #c5cbd1; box-shadow: none; color: #7b838d;
  border-left: 5px solid #b9c0c7;
}
.card.completed .priority { background: #d4d8dd; color: #737d88; }
.card.completed .tag { background: #d4d8dd; color: #737d88; }
.card.completed h3, .card.completed .end-date, .card.completed .description,
.card.completed .member-line, .card.completed .card-bottom { color: #7c848d; }
.card.completed .member-line span { background: #dce0e4; }

/* ---------------- 待排期 / 逾期 ---------------- */
.pending, .overdue-box {
  margin-top: 10px; font-size: 12px; color: #7a8793; border-radius: 8px;
  padding: 9px 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.pending { background: #f3f6f8; border: 1px dashed #d6dee5; }
.overdue-box { background: #fdf1ef; border: 1px solid #efcfcb; }
.pending strong, .overdue-box strong { font-size: 11px; color: #8a5a55; margin-right: 4px; }
.overdue-box strong { color: #a03f3a; }
.overdue-box.spaced { margin-top: 12px; }
.pending button, .overdue-box button { margin: 2px; padding: 5px 9px; font-size: 12px; }

/* ---------------- 人员负荷 ---------------- */
#workload { border: 1px solid #dce3e9; background: #fff; border-radius: 10px; padding: 16px; margin-bottom: 24px; }
.load-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.load-head h2 { font-size: 17px; margin: 0 0 6px; }
.load-head .load-range { font-size: 12px; color: #72818d; }
.load-controls { display: flex; gap: 8px; align-items: center; }
.load-controls select { padding: 7px 8px; border: 1px solid var(--line); border-radius: 5px; background: #fff; font-size: 12px; }
.load-summary { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.chip { background: #f1f4f7; border-radius: 6px; padding: 5px 9px; font-size: 11px; color: #5c7082; }
.chip b { color: #2c465c; }
.chip.warn { background: #fdf1ef; color: #9d4640; }
.load-help { font-size: 11px; color: #82909b; line-height: 1.8; margin: 10px 0; }
.person-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.person { border: 1px solid #e0e6eb; border-radius: 7px; background: #f8fafc; padding: 10px; }
.person summary { cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; list-style: none; }
.person summary strong { font-size: 13px; }
.person summary .load-note { font-size: 10px; color: #8b97a1; display: block; margin-top: 2px; font-weight: 400; }
.person summary span { font-size: 11px; color: #6c8192; text-align: right; }
.person.busy { background: #fff2e9; border-color: #e9b38c; }
.person.busy summary span { color: #ae591c; }
.person.unassigned { border-style: dashed; background: #f6f8f9; }
.person-projects { margin-top: 9px; border-top: 1px solid #dce3e9; padding-top: 7px; font-size: 11px; line-height: 1.8; color: #798996; }
.person-projects button { display: block; width: 100%; text-align: left; font-size: 12px; margin: 4px 0; padding: 7px; }
.person-projects small { display: block; color: #81919f; font-size: 10px; margin-top: 2px; }
.load-empty { color: #7c8d9a; font-size: 12px; padding: 12px 0; }
.missing-list { margin-top: 12px; font-size: 11px; color: #8a5a55; line-height: 1.9; }
.missing-list button { padding: 4px 8px; font-size: 11px; margin: 2px; }

/* ---------------- 弹窗 ---------------- */
dialog {
  border: 0; border-radius: 14px; padding: 22px; max-width: 720px; width: calc(100% - 32px);
  max-height: 92vh; box-shadow: 0 25px 100px #1f354644; overflow: auto;
}
dialog.wide { max-width: 980px; }
dialog::backdrop { background: #1a2c3c66; }
h2 { margin: 0; font-size: 19px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 10px; }
.dialog-head .subhead { font-size: 11px; color: #83909b; margin-top: 4px; }
.icon { border: 0; font-size: 22px; padding: 0 8px; background: transparent; color: #62727f; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fields .wide { grid-column: 1 / -1; }
dialog label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: #6c7b89; }
dialog input, dialog select, dialog textarea {
  border: 1px solid #d8e0e7; border-radius: 6px; padding: 8px 9px; background: #fff; color: #243746; min-width: 0;
}
dialog textarea { resize: vertical; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; border-top: 1px solid var(--line); padding-top: 15px; flex-wrap: wrap; }
.dialog-foot .left { margin-right: auto; display: flex; gap: 8px; }
.hint { font-size: 11px; line-height: 1.7; color: #87939c; margin: 8px 0 0; }
.field-block { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: #6c7b89; }
.field-label { font-size: 12px; color: #6c7b89; }
.field-label small { color: #8b97a1; }
.req { color: #b4553f; }
.fields .wide { grid-column: 1 / -1; }
.field-block input[type="search"] {
  border: 1px solid #d8e0e7; border-radius: 6px; padding: 7px 9px; background: #fff; color: #243746;
}
.error-text { font-size: 12px; color: #ae4444; margin: 10px 0 0; min-height: 16px; }
.notice { background: #f4f8fb; border: 1px solid #d7e4ee; color: #3c5d76; border-radius: 8px; padding: 10px 12px; font-size: 12px; line-height: 1.7; margin: 10px 0; }
.notice.warn { background: #fdf6e8; border-color: #ecd9ad; color: #7c5c17; }
.notice.danger { background: #fdf1ef; border-color: #efcfcb; color: #953f3a; }
.one-time-password { font-family: Consolas, "Courier New", monospace; font-size: 16px; letter-spacing: .5px; background: #fff; border: 1px dashed #b9c9d6; border-radius: 6px; padding: 9px 11px; display: inline-block; margin: 6px 6px 6px 0; overflow-wrap: anywhere; }

/* 人员选择器 */
.member-picker { border: 1px solid #d8e0e7; border-radius: 8px; padding: 9px; max-height: 210px; overflow: auto; background: #fbfcfd; }
.member-group-title { font-size: 11px; color: #7a8996; font-weight: 650; margin: 4px 0 6px; }
.member-option { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #405469; padding: 4px 2px; }
.member-option input { width: auto; }
.member-option .mnote { color: #8b97a1; font-size: 11px; }
.member-option .off { color: #9aa4ad; }
.selected-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; min-height: 22px; }
.selected-chips span { background: #e8f0f7; color: #2f5a7c; border-radius: 4px; padding: 4px 7px; font-size: 11px; }
.selected-chips span button { border: 0; background: transparent; padding: 0 0 0 3px; color: #6b7f90; font-size: 12px; }

/* 表格（名册 / 账号 / 审计） */
.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th, .table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid #edf1f4; vertical-align: middle; }
.table th { color: #7d8a95; font-weight: 600; font-size: 11px; background: #f7f9fa; }
.table input[type="text"], .table select { padding: 6px 7px; border: 1px solid #d8e0e7; border-radius: 5px; width: 100%; }
.table .row-actions { white-space: nowrap; display: flex; gap: 4px; }
.table .inactive-row { color: #9aa4ad; }
.form-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.form-row label { min-width: 130px; }
.section-title { font-size: 13px; font-weight: 650; margin: 16px 0 8px; color: #33495c; }
.badge-off { background: #eceff1; color: #8a949c; border-radius: 4px; padding: 2px 6px; font-size: 10px; }
.badge-stale { background: #fbe9c9; color: #8a631d; border-radius: 4px; padding: 2px 6px; font-size: 10px; }
.audit-detail { max-width: 380px; overflow-wrap: anywhere; color: #63767f; }

/* toast / 登录 */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #273f51; color: #fff; border-radius: 8px; padding: 11px 18px; display: none;
  z-index: 100; max-width: 90vw; font-size: 13px; line-height: 1.5;
}
#toast.visible { display: block; }
#toast.error { background: #8f3631; }
#toast.success { background: #2c5c48; }
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 30px; box-shadow: 0 20px 60px #1f35461f; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand h1 { font-size: 20px; margin: 0; }
.login-brand p { margin: 4px 0 0; color: #7d8a95; font-size: 12px; }
.login-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; font-size: 12px; color: #5f7180; }
.login-field input { padding: 10px; border: 1px solid #d8e0e7; border-radius: 7px; font-size: 14px; }
.captcha-row { display: flex; gap: 8px; align-items: stretch; }
.captcha-row input { flex: 1; }
.captcha-image { border: 1px solid #d8e0e7; border-radius: 7px; background: #f7f9fb; width: 150px; height: 52px; padding: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.captcha-image img { width: 150px; height: 52px; display: block; }
.login-submit { width: 100%; padding: 11px; margin-top: 6px; font-size: 14px; }
.login-error { color: #ae4444; font-size: 12px; min-height: 18px; margin: 4px 0 8px; }
.login-foot { margin-top: 16px; font-size: 11px; color: #8b97a1; line-height: 1.7; text-align: center; }

footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  color: #8b97a1; font-size: 11px; border-top: 1px solid var(--line);
  padding: 16px 26px; max-width: 1600px; margin: 0 auto;
}

@media (max-width: 1000px) {
  header.topbar { padding: 8px 14px; gap: 8px; }
  .brand small { display: none; }
  .header-actions { gap: 5px; }
  .header-actions .label-btn { display: none; }
  main { padding: 16px 14px 8px; }
  .week-grid { overflow-x: auto; grid-template-columns: repeat(4, 280px); padding-bottom: 8px; }
  .person-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields { grid-template-columns: 1fr; }
  .fields .wide { grid-column: auto; }
  footer { padding: 14px; }
}
@media (max-width: 560px) {
  .brand strong { font-size: 15px; white-space: nowrap; }
  .brand .mark { padding: 8px 9px; font-size: 14px; }
  .header-actions { gap: 4px; }
  .person-grid { grid-template-columns: 1fr; }
  .load-head { align-items: flex-start; flex-direction: column; }
  .account .who { max-width: 74px; }
  .tabs button { padding: 8px 12px; }
  .week-grid { grid-template-columns: repeat(4, 260px); }
}
