:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #101a33;
  --muted: #6b768a;
  --line: #dfe6f0;
  --table-head: #f3f6fb;
  --brand: #4d72d8;
  --brand-strong: #3d61c2;
  --accent: #4d72d8;
  --navy: #101a33;
  --mint: #20a67a;
  --rose: #b9505f;
  --amber: #b9791b;
  --shadow: 0 10px 24px rgba(16, 26, 51, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.login-panel {
  background: var(--panel);
  width: min(430px, calc(100vw - 40px));
  padding: 64px 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: none;
}

.login-panel .field input {
  height: 44px;
}

.login-panel .primary-btn {
  min-height: 42px;
  padding: 0 18px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0;
  margin: 0 0 4px;
}

.brand-row strong {
  font-size: 18px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.primary-btn {
  background: var(--brand);
  color: #fff;
}

.primary-btn:hover {
  background: var(--brand-strong);
}

.secondary-btn {
  background: #edf3ff;
  color: var(--brand-strong);
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
}

.danger-btn {
  background: #fdecef;
  color: var(--rose);
}

.primary-btn:disabled,
.secondary-btn:disabled,
.ghost-btn:disabled,
.danger-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.login-error {
  min-height: 22px;
  color: var(--rose);
  font-size: 13px;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px 1fr;
}

.sidebar {
  background: #15213a;
  color: #d7dee9;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.side-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.side-title .brand-mark {
  width: 36px;
  height: 36px;
  background: var(--brand);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  width: 100%;
  justify-content: flex-start;
  border: 0;
  color: #d7dee9;
  background: transparent;
  border-radius: 6px;
  padding: 11px 12px;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  background: rgba(63, 112, 214, 0.22);
  color: #fff;
}

.nav button.active {
  box-shadow: inset 3px 0 0 var(--brand);
}

.user-box {
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.user-box strong {
  display: block;
  color: #fff;
  margin-bottom: 4px;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 70px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.content {
  padding: 24px 28px 36px;
  display: grid;
  gap: 20px;
}

.filters,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(16, 26, 51, 0.02);
}

.filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: end;
}

.team-filter-toolbar {
  display: grid;
  gap: 10px;
}

.filter-label {
  color: var(--muted);
  font-size: 13px;
}

.team-filter-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.team-filter-buttons button {
  height: 38px;
  min-width: 78px;
  border: 1px solid #d6d9df;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 15px;
  white-space: nowrap;
  font-size: 15px;
}

.team-filter-buttons button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.date-toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow-x: auto;
  padding: 2px 0;
  -webkit-overflow-scrolling: touch;
}

.preset-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.preset-btn {
  height: 42px;
  border: 1px solid #d6d9df;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 17px;
  min-width: 86px;
  white-space: nowrap;
  font-size: 16px;
}

.preset-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.custom-label,
.date-separator {
  color: #98a2b3;
  white-space: nowrap;
  font-size: 15px;
}

.date-box {
  height: 42px;
  min-width: 176px;
  border: 1px solid #d6d9df;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-size: 16px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.manual-board-cards {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.overview-hero {
  min-height: 88px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  box-shadow: var(--shadow);
}

.overview-hero h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.overview-hero p {
  margin: 0;
  color: var(--muted);
}

.overview-hero span {
  border-radius: 999px;
  background: #edf3ff;
  color: var(--brand-strong);
  padding: 8px 14px;
  font-weight: 700;
  white-space: nowrap;
}

.overview-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.overview-team-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.overview-team-card span {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}

.overview-team-card strong {
  display: block;
  font-size: 27px;
  line-height: 1.15;
}

.overview-team-card p {
  margin: 8px 0 0;
  color: #98a2b3;
  font-size: 13px;
}

.team-color-0 {
  border-top-color: var(--line);
}

.team-color-1 {
  border-top-color: var(--line);
}

.team-color-2 {
  border-top-color: var(--line);
}

.team-color-3 {
  border-top-color: var(--line);
}

.team-color-4 {
  border-top-color: var(--line);
}

.team-color-5 {
  border-top-color: var(--line);
}

.overview-board {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.overview-board-head {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.overview-board-head h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.overview-board-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.overview-board-head .date-toolbar {
  grid-column: auto;
}

.overview-table-wrap {
  overflow: auto;
  max-height: 620px;
  -webkit-overflow-scrolling: touch;
}

.overview-table {
  min-width: 1380px;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

.employee-matrix-table {
  min-width: 1280px;
}

.overview-table th {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--table-head);
  color: #263653;
  border-bottom-color: var(--line);
  text-align: center;
}

.overview-table thead tr:nth-child(2) th {
  top: 47px;
}

.overview-table td {
  text-align: center;
}

.overview-table .team-heading {
  border-top: 3px solid var(--brand);
  font-size: 15px;
}

.overview-table .summary-row td {
  position: sticky;
  top: 94px;
  z-index: 5;
  background: #f1f5fb;
  color: #18233a;
  font-weight: 800;
}

.overview-table tbody tr:nth-child(2n + 3) td {
  background: #fff;
}

.overview-table .sticky-col {
  position: sticky;
  z-index: 4;
  box-shadow: 1px 0 0 var(--line);
}

.overview-table .sticky-date {
  left: 0;
  width: 86px;
  min-width: 86px;
  max-width: 86px;
}

.overview-table .sticky-week {
  left: 86px;
  width: 74px;
  min-width: 74px;
  max-width: 74px;
}

.overview-table th.sticky-col {
  top: 0;
  z-index: 8;
  background: var(--table-head);
}

.overview-table td.sticky-col {
  background: #fff;
}

.overview-table .summary-row td.sticky-col {
  z-index: 9;
  background: #f1f5fb;
}

.overview-table tbody tr:nth-child(2n + 3) td.sticky-col {
  background: #fff;
}

.overview-table .group-start {
  border-left: 8px solid #e6edf7;
  box-shadow: inset 1px 0 0 #d8e2ef;
}

.overview-table .group-head {
  box-shadow: inset 1px 0 0 #d8e2ef;
}

.overview-table .group-head.group-0,
.overview-table th.group-0 {
  background: #f4f7ff;
}

.overview-table .group-head.group-1,
.overview-table th.group-1 {
  background: #f7f9ff;
}

.overview-table .group-head.group-2,
.overview-table th.group-2 {
  background: #f3faf8;
}

.overview-table .group-head.group-3,
.overview-table th.group-3 {
  background: #fff8f0;
}

.overview-table .group-head.group-4,
.overview-table th.group-4 {
  background: #f7f4ff;
}

.overview-table .group-head.group-5,
.overview-table th.group-5 {
  background: #f2f9fc;
}

.overview-table td.group-0 {
  background: #fbfdff;
}

.overview-table td.group-1 {
  background: #fcfdff;
}

.overview-table td.group-2 {
  background: #fbfffd;
}

.overview-table td.group-3 {
  background: #fffdf9;
}

.overview-table td.group-4 {
  background: #fdfcff;
}

.overview-table td.group-5 {
  background: #fbfeff;
}

.overview-table tbody tr:nth-child(2n + 3) td.group-0 {
  background: #f7fbff;
}

.overview-table tbody tr:nth-child(2n + 3) td.group-1 {
  background: #f9fbff;
}

.overview-table tbody tr:nth-child(2n + 3) td.group-2 {
  background: #f7fcfa;
}

.overview-table tbody tr:nth-child(2n + 3) td.group-3 {
  background: #fffaf3;
}

.overview-table tbody tr:nth-child(2n + 3) td.group-4 {
  background: #faf7ff;
}

.overview-table tbody tr:nth-child(2n + 3) td.group-5 {
  background: #f7fcff;
}

.overview-table .summary-row td.group-0 {
  background: #edf4ff;
}

.overview-table .summary-row td.group-1 {
  background: #f0f4ff;
}

.overview-table .summary-row td.group-2 {
  background: #ecf7f4;
}

.overview-table .summary-row td.group-3 {
  background: #fff3e8;
}

.overview-table .summary-row td.group-4 {
  background: #f3efff;
}

.overview-table .summary-row td.group-5 {
  background: #edf8fc;
}

.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(16, 26, 51, 0.02);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.metric-card strong {
  font-size: 26px;
  line-height: 1.2;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  white-space: nowrap;
  font-size: 14px;
}

th {
  background: var(--table-head);
  color: #263653;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.team-data-table {
  min-width: 980px;
}

.team-data-table th,
.team-data-table td {
  text-align: center;
}

.team-data-table th:first-child,
.team-data-table td:first-child,
.team-data-table th:nth-child(2),
.team-data-table td:nth-child(2) {
  text-align: left;
}

.ranking-filter-panel .date-toolbar {
  margin-top: 12px;
}

.rank-search {
  width: min(260px, 100%);
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

.ranking-table {
  min-width: 920px;
}

.ranking-table th,
.ranking-table td {
  text-align: center;
}

.ranking-table tfoot td {
  background: #eef4ff;
  font-weight: 800;
  border-top: 2px solid var(--primary);
}

.ranking-table th:nth-child(2),
.ranking-table td:nth-child(2),
.ranking-table th:nth-child(3),
.ranking-table td:nth-child(3) {
  text-align: left;
}

.sort-head {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.rank-team-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--primary);
  font-weight: 700;
}

.personnel-groups {
  display: grid;
  gap: 16px;
}

.personnel-team-panel table {
  min-width: 520px;
}

.personnel-team-panel th,
.personnel-team-panel td {
  text-align: center;
}

.personnel-team-panel th:first-child,
.personnel-team-panel td:first-child {
  text-align: left;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 700;
  font-size: 13px;
}

.status-pill.on {
  background: #e8f7ee;
  color: #16834a;
}

.status-pill.off {
  background: #f2f4f7;
  color: #667085;
}

.team-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.team-tabs button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 6px;
  min-height: 34px;
  padding: 0 12px;
}

.team-tabs button.active {
  border-color: var(--brand);
  background: #e8f3f6;
  color: var(--brand-strong);
}

.employee-groups {
  display: grid;
  gap: 16px;
}

.employee-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.employee-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.employee-card-head h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.employee-card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.employee-card .table-wrap {
  border: 0;
  border-radius: 0;
}

.employee-card table {
  min-width: 620px;
}

.employee-mini-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.employee-mini-metrics span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  padding: 0 9px;
  font-size: 12px;
}

.employee-mini-metrics strong {
  color: var(--ink);
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.notice {
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff8e8;
  color: #715118;
  border: 1px solid #f3d28a;
  font-size: 13px;
  line-height: 1.6;
}

.success {
  background: #e8f8f1;
  border-color: #a7e0c6;
  color: #176247;
}

.danger-text {
  color: var(--rose);
}

.muted {
  color: var(--muted);
}

@media (max-width: 1100px) {
  .login-screen {
    align-items: center;
  }

  .layout {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 12px 16px;
    gap: 10px;
    box-shadow: 0 8px 22px rgba(16, 26, 51, 0.16);
  }

  .side-title {
    padding: 0 4px 10px;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .nav button {
    width: auto;
    flex: 0 0 auto;
    justify-content: center;
    padding: 9px 13px;
    white-space: nowrap;
  }

  .nav button.active {
    box-shadow: inset 0 -3px 0 var(--brand);
  }

  .user-box {
    margin-top: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px 12px;
    padding: 9px 10px;
  }

  .user-box .ghost-btn {
    grid-row: 1 / span 2;
    grid-column: 2;
  }

  .filters,
  .cards,
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .employee-card-head {
    flex-direction: column;
  }

  .employee-mini-metrics {
    justify-content: flex-start;
  }

  .overview-board-head {
    grid-template-columns: 1fr;
  }

  .overview-board-head .date-toolbar {
    width: 100%;
  }
}

@media (max-width: 680px) {
  .content,
  .topbar {
    padding-left: 18px;
    padding-right: 18px;
  }

  .login-panel {
    width: calc(100vw - 36px);
    margin: 0 auto;
    padding: 42px 0;
  }

  .sidebar {
    padding: 10px 12px;
  }

  .side-title {
    border-bottom: 0;
    padding-bottom: 4px;
  }

  .side-title .brand-mark {
    width: 32px;
    height: 32px;
  }

  .nav {
    margin: 0 -4px;
    padding: 0 4px 4px;
  }

  .nav button {
    min-height: 36px;
    padding: 8px 11px;
    font-size: 14px;
  }

  .user-box {
    font-size: 12px;
  }

  .filters,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .cards,
  .overview-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .manual-board-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-card,
  .overview-team-card {
    padding: 13px;
  }

  .metric-card strong,
  .overview-team-card strong {
    font-size: 22px;
  }

  .metric-card span,
  .overview-team-card span,
  .overview-team-card p {
    font-size: 12px;
  }

  .filters,
  .panel,
  .overview-board-head,
  .overview-hero {
    padding: 14px;
  }

  .date-toolbar {
    align-items: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .preset-group {
    overflow-x: auto;
    width: auto;
    padding-bottom: 2px;
  }

  .preset-btn {
    height: 38px;
    min-width: 78px;
    padding: 0 13px;
    font-size: 14px;
  }

  .date-box {
    height: 38px;
    flex: 0 0 150px;
    min-width: 150px;
    font-size: 14px;
  }

  .team-filter-buttons button {
    height: 36px;
    min-width: 70px;
    padding: 0 12px;
    font-size: 14px;
  }

  .topbar {
    height: auto;
    min-height: 70px;
    align-items: flex-start;
    flex-direction: column;
    padding-top: 16px;
    padding-bottom: 16px;
    gap: 10px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-actions,
  .panel-actions .primary-btn {
    width: 100%;
  }

  .rank-search {
    width: 100%;
  }

  .ranking-table {
    min-width: 820px;
  }

  .overview-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  th,
  td {
    padding: 10px 11px;
    font-size: 13px;
  }

  .overview-table-wrap {
    max-height: 70vh;
  }
}

@media (max-width: 420px) {
  .content,
  .topbar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .cards,
  .overview-cards,
  .manual-board-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-card strong,
  .overview-team-card strong {
    font-size: 20px;
  }
}
