:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d8dee8;
  --panel: #ffffff;
  --page: #f5f7fb;
  --blue: #2563eb;
  --green: #17805d;
  --amber: #a15c07;
  --red: #c2413b;
  --nav: #192433;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--page);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  cursor: pointer;
}

button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

button.danger {
  color: var(--red);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.spinner {
  width: 16px;
  height: 16px;
  display: inline-block;
  flex: 0 0 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.button-busy::before,
.modal[data-busy="1"] button[type="submit"]::before,
.modal[data-busy="1"] button.primary::before {
  width: 14px;
  height: 14px;
  display: inline-block;
  margin-right: 7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 700ms linear infinite;
  content: "";
}

.modal[data-busy="1"] button { pointer-events: none; opacity: .65; }

.network-activity {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 95;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(440px, calc(100vw - 32px));
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid #8eb6f4;
  border-radius: 7px;
  background: #eef6ff;
  color: #163f78;
  box-shadow: 0 10px 28px rgba(31, 73, 125, .2);
  font-size: 13px;
  line-height: 1.45;
}

.network-activity[hidden] { display: none; }
.network-activity .spinner { width: 18px; height: 18px; flex-basis: 18px; }

.network-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: 4px;
  overflow: hidden;
  background: rgba(37, 99, 235, .12);
  pointer-events: none;
}

.network-progress[hidden] { display: none; }

.network-progress-bar {
  display: block;
  width: 38%;
  height: 100%;
  background: #2563eb;
  box-shadow: 0 0 8px rgba(37, 99, 235, .5);
  animation: network-indeterminate 1.15s ease-in-out infinite;
}

.network-progress.finishing .network-progress-bar {
  width: 100%;
  transform: none;
  animation: none;
  transition: width 180ms ease;
}

.task-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0;
  padding: 12px 14px;
  border: 1px solid #bed2f3;
  border-radius: 6px;
  background: #f4f8ff;
  color: #2459a6;
}

.task-status p { margin: 3px 0; }
.task-status small { color: var(--muted); }

.date-picker-input {
  padding-right: 34px;
  background-image: linear-gradient(transparent, transparent);
  cursor: pointer;
}

.month-query-control {
  display: grid;
  grid-template-columns: minmax(118px, 1fr) minmax(108px, auto);
  gap: 6px;
}

.annual-company-summary {
  margin: 0 0 12px;
  max-height: none !important;
}

.annual-company-summary table { min-width: 520px; }

.date-picker-popover {
  position: fixed;
  z-index: 80;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(31, 41, 51, .2);
}

.date-picker-head,
.date-picker-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.date-picker-head select { flex: 1 1 auto; }
.date-picker-actions { justify-content: flex-end; margin-top: 10px; }
.date-picker-weekdays,
.date-picker-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.date-picker-weekdays { margin: 10px 0 4px; color: var(--muted); text-align: center; font-size: 11px; }
.date-picker-days button,
.month-picker-grid button { min-width: 0; padding: 7px 4px; }
.date-picker-days button.today { border-color: #8db2ec; }
.date-picker-days button.selected,
.month-picker-grid button.selected { background: var(--blue); border-color: var(--blue); color: #fff; }
.month-picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 10px; }

.company-tag {
  display: inline-flex;
  margin: 1px 4px 1px 0;
  padding: 2px 6px;
  border: 1px solid #c7d7f4;
  border-radius: 5px;
  background: #f2f6ff;
  color: #2459a6;
  font-size: 11px;
}

.relation-section { margin: 12px 0; }
.relation-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.relation-list { display: grid; gap: 8px; }
.relation-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(130px, 1fr) minmax(150px, 1fr) auto; gap: 8px; }

tr.payroll-new-employee td { border-top: 2px solid #b7c5d8; }
tr.payroll-same-employee td:first-child { box-shadow: inset 3px 0 0 #c7d7f4; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes network-indeterminate {
  0% { transform: translateX(-110%); }
  55% { transform: translateX(130%); }
  100% { transform: translateX(285%); }
}

@media (prefers-reduced-motion: reduce) {
  .spinner,
  .button-busy::before,
  .modal[data-busy="1"] button::before { animation-duration: 1800ms; }
  .network-progress-bar {
    width: 65%;
    transform: none;
    animation: none;
  }
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  min-width: 0;
}

textarea {
  min-height: 72px;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(23, 128, 93, 0.08)),
    #f5f7fb;
}

.login-card {
  width: min(920px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(31, 41, 51, 0.16);
}

.login-cover {
  display: grid;
  align-content: space-between;
  gap: 28px;
  padding: 38px;
  color: #f8fbff;
  background:
    linear-gradient(rgba(19, 32, 51, 0.28), rgba(19, 32, 51, 0.42)),
    url("https://images.unsplash.com/photo-1497366811353-6870744d04b2?auto=format&fit=crop&w=1200&q=80") center/cover;
}

.mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  font-weight: 800;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.76);
}

.login-cover h1 {
  margin: 0 0 14px;
  max-width: 10em;
  font-size: 36px;
  line-height: 1.18;
}

.login-cover p {
  max-width: 24em;
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.7;
}

.cover-foot {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cover-foot span {
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  padding: 6px 10px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
}

.login-form {
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 42px;
}

.login-form > label,
.login-form > button,
.password-control {
  width: 100%;
  min-width: 0;
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  display: block;
  width: 100%;
  min-height: 42px;
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 40px;
  min-width: 40px;
  height: calc(100% - 2px);
  padding: 0;
  border: 0;
  border-radius: 0 5px 5px 0;
  background: transparent;
  color: var(--muted);
}

.password-toggle:hover,
.password-toggle:focus-visible {
  background: #f1f5f9;
  color: var(--ink);
}

.login h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.login h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.stack {
  display: grid;
  gap: 12px;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--nav);
  color: #eef2f7;
  padding: 20px 14px;
  overflow: hidden;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  margin: 4px 8px 18px;
}

.nav-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.nav-group {
  margin-bottom: 6px;
  border-radius: 6px;
}

.nav-group-toggle,
.nav-item,
.account-area button {
  width: 100%;
  min-height: 40px;
  border-color: transparent;
  background: transparent;
  color: #dce4ee;
  text-align: left;
}

.nav-group-toggle {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.nav-group-icon,
.account-avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid #4a5a70;
  border-radius: 5px;
  color: #f7fafc;
  font-size: 12px;
  line-height: 1;
}

.nav-chevron,
.account-chevron {
  text-align: center;
  transition: transform 160ms ease;
}

.nav-group.open .nav-chevron,
.account-area.open .account-chevron {
  transform: rotate(180deg);
}

.nav-group.current > .nav-group-toggle,
.nav-group-toggle:hover,
.account-area button:hover {
  background: #223044;
  border-color: #33445b;
}

.nav-items {
  display: grid;
  gap: 3px;
  padding: 3px 0 4px 32px;
}

.nav-items[hidden],
.account-actions[hidden] {
  display: none !important;
}

.nav-item {
  position: relative;
  min-height: 36px;
  padding: 7px 10px 7px 14px;
  color: #bdc9d8;
}

.nav-item.active,
.nav-item:hover {
  background: #263447;
  border-color: #33445b;
  color: #fff;
}

.nav-item.active::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 4px;
  width: 3px;
  border-radius: 2px;
  background: #7fb0ff;
  content: "";
}

.account-area {
  flex: 0 0 auto;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #314055;
}

.account-actions {
  display: grid;
  gap: 3px;
  margin-bottom: 6px;
}

.account-actions button {
  padding-left: 42px;
}

.account-separator {
  height: 1px;
  margin: 3px 8px;
  background: #314055;
}

.account-area .logout-button {
  color: #ffd1cc;
}

.account-toggle {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  padding: 8px;
}

.account-avatar {
  width: 32px;
  height: 32px;
  background: #314258;
  font-size: 14px;
  font-weight: 700;
}

.account-copy {
  min-width: 0;
}

.account-copy strong,
.account-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy small {
  margin-top: 2px;
  color: #aebccd;
  font-size: 11px;
}

.mobile-nav-toggle,
.side-backdrop {
  display: none;
}

.main {
  min-width: 0;
  padding: 22px;
}

.page-head {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.search-shell {
  width: min(860px, 100%);
}

.searchbox {
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.04);
}

.searchbox input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 12px 14px;
}

.searchbox button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: #f8fafc;
  font-size: 20px;
  line-height: 1;
  padding: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar h2 {
  margin: 0;
  font-size: 22px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
  align-items: center;
}

.filters fieldset.form-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  border: 0;
  min-width: 0;
  padding: 0;
  margin: 0;
}
.filters fieldset.form-row legend { font-size: 13px; margin-bottom: 6px; }
.filters fieldset.form-row label { display: flex; flex-direction: row; align-items: center; gap: 6px; min-width: 0; }
.filters fieldset.form-row input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; margin: 0; }

.employee-filter-panel {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  background: #fff;
}

.employee-more-filters {
  margin-top: 10px;
  border-top: 1px solid #edf0f4;
  padding-top: 10px;
}

.employee-more-filters summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.identity-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.employee-identity-section {
  margin-bottom: 14px;
  padding: 0 0 12px;
  border-bottom: 1px solid #edf0f4;
}

.identity-section-head h4 {
  margin: 0;
}

.identity-setting-button {
  width: auto;
  min-width: 74px;
  height: 30px;
  padding: 0 10px;
  white-space: nowrap;
  color: #344054;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 600;
}

.identity-setting-button:hover,
.identity-setting-button:focus-visible {
  color: var(--blue);
  background: #f3f7fb;
  border-color: var(--line);
}

.employee-filters {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
  margin: 0;
}

.employee-filters > label,
.employee-filters > .filter-control {
  min-width: 0;
  max-width: 260px;
}

.employee-filters select,
.filter-control-button,
.multi-filter-trigger {
  width: 100%;
  height: 38px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.filter-control {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.filter-label {
  color: var(--ink);
  font-weight: 600;
}

.multi-filter { min-width: 0; }

.multi-filter-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
}

.multi-filter-trigger > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-filter-chevron { color: var(--muted); text-align: center; }

.multi-filter-trigger:hover,
.multi-filter-trigger:focus-visible,
.filter-control-button:hover,
.filter-control-button:focus-visible {
  border-color: #8eb6f4;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.multi-filter-popover {
  position: fixed;
  z-index: 110;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  min-height: 210px;
  padding: 10px;
  border: 1px solid #bdc9d8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(31, 41, 51, .2);
  overflow: hidden;
}

.multi-filter-popover[hidden] { display: none; }
.multi-filter-search { width: 100%; }

.multi-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.multi-filter-actions button {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 4px 7px;
}

.multi-filter-options {
  min-height: 0;
  overflow-y: auto;
  border-top: 1px solid #edf0f5;
  border-bottom: 1px solid #edf0f5;
  padding: 4px 0;
}

.multi-filter-option {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
}

.multi-filter-option:hover { background: #fff7d6; }
.multi-filter-option[hidden] { display: none; }
.multi-filter-option input { width: 16px; height: 16px; margin: 0; }
.multi-filter-option span { overflow-wrap: anywhere; font-weight: 500; }
.multi-filter-empty { padding: 8px; color: var(--muted); text-align: center; }

.employee-time-chips {
  grid-column: 1 / -1;
  padding-top: 2px;
}

.filter-and-hint {
  color: var(--muted);
  font-size: 12px;
}

.time-filter-bar {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.time-filter-actions,
.active-filter-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.subtle-button,
.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 4px 6px;
}

.subtle-button:hover,
.link-button:hover {
  background: #eef4ff;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px 6px 4px 10px;
  border: 1px solid #c7d7f4;
  border-radius: 999px;
  background: #f2f6ff;
  color: #2459a6;
  font-size: 12px;
}

.filter-chip button,
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 18px;
  line-height: 1;
}

.filter-chip button:hover,
.icon-button:hover {
  background: rgba(37, 99, 235, 0.12);
}

.time-filter-modal {
  display: grid;
  gap: 12px;
}

.time-condition-editor {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) minmax(180px, 1.5fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f5;
}

.time-condition-dates {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.time-condition-dates input,
.time-condition-dates select {
  width: 100%;
  min-width: 0;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.column-chooser-trigger {
  justify-self: start;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}

.panel.compact {
  padding: 12px 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  align-items: end;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

label span {
  color: var(--ink);
  font-weight: 600;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

th.selection-cell,
td.selection-cell {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  padding: 9px 6px;
  text-align: center;
  vertical-align: middle;
}

.selection-cell input {
  display: block;
  width: 16px;
  min-width: 16px;
  height: 16px;
  margin: 0 auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  border-bottom: 1px solid #edf0f5;
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
  font-size: 13px;
}

th {
  background: #eef3f8;
  color: #344054;
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 700;
}

th.numeric {
  text-align: right;
}

.th-button {
  display: inline-flex;
  width: 100%;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

th.numeric .th-button {
  justify-content: flex-end;
}

.table-total-row td {
  position: sticky;
  top: 38px;
  z-index: 1;
  border-top: 1px solid #c8d2dc;
  border-bottom: 1px solid #b8c4d0;
  background: #f7fafc;
  color: #263746;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(30, 41, 59, 0.06);
}

.table-total-row:hover td { background: #f7fafc; }
.table-total-row .total-label { min-width: 150px; }
.table-total-row[data-total-abnormal="1"] .total-label { color: #a33a2b; }
.table-total-row td.table-action-sticky { z-index: 3; background: #f7fafc; }

.th-button.active {
  color: var(--blue);
}

tbody tr:nth-child(even) td {
  background: #fafbfd;
}

tbody tr:hover td {
  background: #fff3cd;
}

tbody tr.selected-row td,
tbody tr.selected-row:nth-child(even) td {
  background: #fff1b8;
}

tbody tr.selected-row:hover td {
  background: #ffe89a;
}

td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.numeric-text {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td input {
  width: 112px;
  padding: 5px 6px;
}

td input.numeric-input {
  width: 100%;
  min-width: 92px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tr.clickable {
  cursor: pointer;
}

tr.clickable:hover td {
  background: #fff3cd;
}

tr.attendance-anomaly td,
tr.attendance-anomaly:nth-child(even) td {
  background: #fff0ef;
}

tr.attendance-anomaly td:first-child {
  box-shadow: inset 4px 0 0 #c2413b;
}

tr.attendance-anomaly:hover td {
  background: #ffe4df;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1d4ed8;
  font-size: 12px;
  border: 1px solid #c7d7f4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 1px 2px rgba(31, 41, 51, 0.08);
  font-weight: 700;
}

.ok {
  background: #e9f8f1;
  color: var(--green);
}

.status-green { background: #e9f8f1; color: #136c50; border-color: #b9dfce; }
.status-teal { background: #e5f8f5; color: #08766d; border-color: #abdcd6; }
.status-blue { background: #eaf2ff; color: #2459a6; border-color: #bed2f3; }
.status-orange { background: #fff5e3; color: #995404; border-color: #efd09a; }
.status-red { background: #fff0ef; color: #b43b35; border-color: #efbbb7; }
.status-gray { background: #f2f4f7; color: #596273; border-color: #d6dae1; }

.status-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid #d6dae1;
  border-radius: 4px;
  background: #f2f4f7;
  color: #596273;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 1px 2px rgba(31, 41, 51, 0.08);
  white-space: nowrap;
}

.warning-row td {
  background: #fff9e8;
}

.warn {
  background: #fff7e6;
  color: var(--amber);
}

.bad {
  background: #fff0ef;
  color: var(--red);
}

.message {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: #eef4ff;
  color: #1d4ed8;
}

.message.error {
  background: #fff0ef;
  color: var(--red);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.42);
}

.modal {
  width: min(1080px, 100%);
  max-height: min(86vh, 860px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(31, 41, 51, 0.24);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.modal-head h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
  font-size: 24px;
  line-height: 1;
}

.modal-body {
  overflow: auto;
  padding: 18px;
}

.maintenance-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.maintenance-table th,
.maintenance-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.maintenance-table th { background: #f8fafc; }
.maintenance-check { display: inline-flex; align-items: center; gap: 8px; }

.maintenance-pending {
  margin: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.maintenance-pending summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px;
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
}

.maintenance-pending summary::marker { color: var(--muted); }
.maintenance-pending summary span:last-child { color: var(--muted); font-size: 13px; }
.maintenance-pending[open] summary span:last-child { font-size: 0; }
.maintenance-pending[open] summary span:last-child::after { content: "收起"; font-size: 13px; }
.maintenance-pending-body { padding: 0 2px 12px; }
.maintenance-pending-body p { margin: 0 0 10px; color: var(--muted); }

.pending-bonus-filters {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin: 14px 0 10px;
}

.pending-bonus-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.pending-bonus-toolbar select { width: auto; min-width: 150px; }
.pending-bonus-table { max-height: min(52vh, 560px); }
.pending-bonus-table table { min-width: 1180px; }
.pending-bonus-table td { vertical-align: top; }
.pending-bonus-table td strong,
.pending-bonus-table td span,
.pending-bonus-table td small { display: block; }
.pending-bonus-table td small { margin-top: 3px; color: var(--muted); white-space: normal; }
.pending-bonus-table td select { min-width: 112px; }

.reconciliation-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid #f0c36a;
  border-radius: 6px;
  background: #fff8e6;
}

.reconciliation-action p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.reconciliation-action.confirmed { border-color: #9ad6b5; background: #effaf3; }
.reconciliation-action-buttons { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

@media (max-width: 760px) {
  .pending-bonus-filters { grid-template-columns: 1fr; }
  .pending-bonus-toolbar > * { flex: 1 1 140px; }
  .reconciliation-action { align-items: stretch; flex-direction: column; }
  .reconciliation-action-buttons { justify-content: flex-start; }
}

.modal-body h4 {
  margin: 18px 0 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.employee-merge-dialog {
  display: grid;
  gap: 14px;
}

.merge-tabs {
  margin: -4px 0 0;
  border-bottom: 1px solid var(--line);
}

.merge-tabs button {
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.merge-selection-form,
.merge-preview,
.merge-records,
.merge-result {
  display: grid;
  gap: 12px;
}

.merge-select-grid,
.merge-relation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.merge-employee-field {
  position: relative;
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
}

.merge-employee-field.open { z-index: 8; }

.merge-employee-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.merge-employee-input-wrap {
  position: relative;
}

.merge-employee-input {
  width: 100%;
  min-width: 0;
  padding-right: 38px;
}

.merge-employee-field.has-selection .merge-employee-input {
  border-color: #5f8f7b;
  background: #f7fbf9;
}

.merge-employee-clear {
  position: absolute;
  top: 50%;
  right: 7px;
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #667085;
  font-size: 20px;
  line-height: 1;
  transform: translateY(-50%);
}

.merge-employee-clear:hover { background: #edf1f4; }

.merge-employee-selected {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #bdd3c9;
  border-radius: 6px;
  background: #f3f9f6;
  color: #52616b;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.merge-employee-selected-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
  color: var(--text);
}

.merge-employee-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid #9ec6af;
  border-radius: 999px;
  background: #e9f6ee;
  color: #21683e;
  font-size: 11px;
  font-weight: 700;
}

.merge-employee-status.merged {
  border-color: #d7a6a6;
  background: #fff0f0;
  color: #9b2c2c;
}

.merge-employee-status.archived {
  border-color: #d7bd82;
  background: #fff7df;
  color: #805a00;
}

.merge-employee-results {
  position: absolute;
  top: 65px;
  right: 0;
  left: 0;
  z-index: 10;
  max-height: min(340px, 42vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #b9c3ce;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(31, 41, 55, 0.18);
}

.merge-employee-option {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  border-radius: 0;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.merge-employee-option:last-child { border-bottom: 0; }
.merge-employee-option:hover,
.merge-employee-option.active { background: #fff8d9; }
.merge-employee-option.active { box-shadow: inset 3px 0 #c69016; }
.merge-employee-option:disabled { cursor: not-allowed; opacity: 0.68; background: #f8f8f8; }

.merge-employee-option-main,
.merge-employee-option-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
}

.merge-employee-option-main > span:not(:last-child)::after,
.merge-employee-option-meta > span:not(:last-child)::after {
  content: "/";
  margin-left: 7px;
  color: #a0a8b2;
}

.merge-employee-option-meta {
  color: #667085;
  font-size: 12px;
}

.merge-employee-option-meta .merge-employee-status::after { content: none; }

.merge-employee-empty {
  padding: 20px 12px;
  color: var(--muted);
  text-align: center;
}

.merge-preview-identities {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.merge-preview-identities > div {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid #d8e0e8;
  border-radius: 6px;
  background: #f8fafb;
}

.merge-preview-identities span { color: var(--muted); font-size: 12px; }
.merge-preview-identities strong { overflow-wrap: anywhere; }

.merge-option-legend,
.merge-record-count {
  color: var(--muted);
  font-size: 12px;
}

.merge-relation-grid section {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #e1e7ef;
  border-radius: 6px;
  background: #fbfcfe;
}

.merge-relation-grid ul {
  margin: 7px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.65;
}

.merge-count-table table { min-width: 520px; }
.merge-record-search { max-width: 460px; }
.merge-record-search input { width: 100%; }
.merge-records table { min-width: 1040px; }
.merge-records td:nth-child(5) { min-width: 260px; white-space: normal; }

.employee-merge-modal {
  width: min(95vw, 1540px);
  height: min(92vh, 980px);
  max-height: 92vh;
}

.employee-merge-modal .modal-body {
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.employee-merge-modal .employee-merge-dialog {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
}

.employee-merge-modal .merge-tabs {
  padding: 12px 18px 0;
  background: #fff;
}

.employee-merge-modal [data-merge-pane] {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 18px 0;
}

.employee-merge-modal [data-merge-pane] > .merge-selection-form,
.employee-merge-modal [data-merge-pane] > .merge-preview,
.employee-merge-modal [data-merge-pane] > .merge-result { min-height: 100%; }

.employee-merge-modal .merge-selection-form { grid-template-rows: auto auto auto minmax(0, 1fr) auto; }

.employee-merge-modal .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 6;
  align-self: end;
  margin: auto -18px 0;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -6px 16px rgba(30, 41, 59, 0.08);
}

.merge-direction-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.merge-direction-arrow { display: grid; place-items: center; color: #52616b; font-weight: 700; }
.merge-direction-grid .merge-preview-identities { display: block; }
.merge-direction-grid .merge-preview-identities > div { height: 100%; }
.merge-difference-table .difference-old { background: #fff9ed; }
.merge-difference-table .difference-new { background: #f1faf5; }
.merge-difference-table .warning-row td { white-space: normal; }

.calendar-workspace-modal {
  width: min(95vw, 1500px);
  height: min(92vh, 960px);
  max-height: 92vh;
}

.calendar-rule-workspace,
.calendar-detail-view,
.calendar-copy-preview { display: grid; gap: 14px; }

.calendar-workspace-toolbar,
.calendar-copy-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.calendar-workspace-toolbar > div:not(.month-stepper) { display: grid; gap: 3px; margin-right: auto; }
.calendar-workspace-toolbar > div > span { color: var(--muted); font-size: 12px; }
.month-stepper { display: grid; grid-template-columns: 38px 122px 38px; }
.month-stepper button { min-width: 38px; padding: 0; font-size: 20px; }
.month-stepper input { min-width: 0; width: 122px; text-align: center; border-radius: 0; }
.compact-calendar-filters { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
.calendar-rules-list { max-height: min(58vh, 590px); }
.calendar-rules-list table { min-width: 1260px; }
.calendar-rules-list td:last-child { display: flex; gap: 6px; }

.calendar-template-workspace,
.calendar-template-editor { display: grid; gap: 14px; min-width: 0; }
.calendar-template-list { max-height: min(60vh, 620px); }
.calendar-template-list table { min-width: 1080px; }
.calendar-template-list td:last-child { display: flex; flex-wrap: wrap; gap: 6px; }
.template-scope-cell { min-width: 280px; max-width: 440px; white-space: normal; line-height: 1.6; }
.calendar-template-layout { display: grid; grid-template-columns: minmax(250px, 330px) minmax(680px, 1fr); gap: 16px; align-items: start; min-width: 0; }
.template-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-content: start; }
.template-settings .wide { grid-column: 1 / -1; }
.template-calendar-panel { min-width: 0; display: grid; gap: 12px; }
.template-scope-picker { max-height: 42vh; overflow: auto; border: 1px solid var(--line); background: var(--panel); }
.template-scope-group + .template-scope-group { border-top: 1px solid var(--line); }
.template-scope-option { min-height: 40px; padding: 8px 10px; display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.template-scope-option:hover { background: #fff8d9; }
.template-scope-option.group { border-bottom: 1px solid var(--line); background: #f8fafc; }
.template-scope-option.child { min-height: 34px; padding-left: 34px; color: var(--muted); }
.template-scope-option input { margin-top: 3px; flex: 0 0 auto; }
.template-scope-option span { min-width: 0; display: grid; gap: 2px; }
.template-scope-option small { color: var(--muted); }
.template-scope-summary { display: flex; flex-wrap: wrap; gap: 6px; }
.rule-calendar .rule-day {
  min-width: 0;
  min-height: 68px;
  padding: 8px 7px;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 3px;
  align-content: start;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  background: #fff;
}
.rule-calendar .rule-day > span,
.rule-calendar .rule-day > strong,
.rule-calendar .rule-day > small { display: block; line-height: 1.25; }
.rule-calendar .rule-day > strong { font-size: 13px; }
.rule-calendar .rule-day > small { color: var(--muted); font-size: 11px; }
.rule-calendar .rule-day.workday { border-color: #8fcdb4; background: #effaf5; }
.rule-calendar .rule-day.restday { border-color: #d8dee8; background: #f7f8fa; }
.rule-calendar .rule-day.holiday { border-color: #e7b95f; background: #fff8df; }
.rule-calendar .rule-day.selected { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.rule-calendar .rule-day.outside { visibility: hidden; }
.rule-current-note { display: block; margin-top: 4px; color: var(--muted); }
.calendar-copy-preview table { min-width: 1120px; }
.calendar-copy-preview {
  min-height: calc(92vh - 112px);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}
.calendar-copy-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 260px)) auto;
  gap: 10px;
  align-items: end;
}
.calendar-copy-filters .pill { align-self: center; justify-self: start; }
.calendar-copy-preview > .modal-actions { position: sticky; bottom: -18px; margin-top: auto; padding: 14px 0 18px; background: #fff; }
.calendar-copy-preview td small { display: block; margin-top: 5px; color: var(--muted); }
.size-week-copy-row { background: #fffaf0; }
.size-week-picker { display: grid; grid-template-columns: repeat(2, minmax(94px, 1fr)); gap: 5px; min-width: 240px; }
.size-week-picker .confirm { grid-column: 1 / -1; margin-top: 4px; padding-top: 6px; border-top: 1px solid #eadbb9; }
.size-week-confirm { margin-top: 2px; padding: 10px 12px; border: 1px solid #e5c36e; border-radius: 6px; background: #fff9e8; }

.detail-grid,
.daily-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.detail-grid > div,
.daily-grid > div {
  min-width: 0;
  border: 1px solid #edf0f5;
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfe;
}

.detail-grid span,
.daily-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.detail-grid strong,
.daily-grid strong {
  display: block;
  min-height: 18px;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 600;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.stats-row > div {
  border: 1px solid #e6ebf2;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fbfcfe;
}

.stats-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.stats-row strong {
  font-size: 18px;
  font-weight: 700;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
  gap: 8px;
  min-width: 840px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.field-chip {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  white-space: normal;
}

.field-chip.selected {
  border-color: #f1b44c;
  background: #fff7e1;
  box-shadow: inset 0 0 0 1px rgba(241, 180, 76, 0.35);
}

.chooser-hint {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 960px) {
  .page-head {
    justify-content: stretch;
  }

  .search-shell {
    width: 100%;
  }

  .filters {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

@media (max-width: 720px) {
  .main {
    padding: 14px;
  }

  .page-head {
    margin-bottom: 14px;
  }

  .searchbox input {
    padding: 11px 12px;
  }

  .table-wrap {
    border-radius: 6px;
  }
}

.day-card {
  min-height: 122px;
  border: 1px solid #dfe5ee;
  border-radius: 6px;
  padding: 8px;
  background: #fbfcfe;
  display: grid;
  gap: 4px;
  align-content: start;
  text-align: left;
  color: var(--ink);
}

.day-card .day-no {
  font-size: 12px;
  color: var(--muted);
}

.day-card .day-no span {
  float: right;
  color: #8b5a00;
  font-size: 10px;
}

.day-card.weekend { background: #f8fafc; }
.day-card.outside { visibility: hidden; }
.day-card.adjusted { box-shadow: inset 0 0 0 2px #e4a72b; }
.day-card.has-anomaly { border-color: #d92d20; box-shadow: inset 0 0 0 1px #d92d20; }
.day-card .day-no .day-anomaly-mark { color: #b42318; font-weight: 800; }
.day-card:hover { background: #fff3cd; border-color: #e2c26c; }

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
  min-width: 840px;
  gap: 8px;
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.attendance-calendar-head {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}

.attendance-calendar-head label { width: 150px; }
.attendance-profile { overflow-x: auto; }
.attendance-calendar-scroll {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-gutter: stable;
}
.attendance-anomaly-summary {
  margin-top: 12px;
  padding: 11px;
  border: 1px solid #efb5b1;
  border-radius: 6px;
  background: #fff7f6;
}
.attendance-anomaly-summary.clear { border-color: #b9dfc8; background: #f1fbf6; color: #187244; }
.anomaly-summary-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.anomaly-summary-head span { color: var(--muted); font-size: 12px; }
.anomaly-list { display: grid; gap: 6px; }
.anomaly-list button {
  display: grid;
  grid-template-columns: auto 94px minmax(180px, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: #fff;
}
.anomaly-list button:disabled { opacity: 1; cursor: default; }
.anomaly-list em { color: #b42318; font-style: normal; font-weight: 700; }
.attendance-day-panel { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfe; }
.day-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.day-panel-head h4 { margin: 0; }
.day-panel-head button { width: 32px; height: 32px; padding: 0; }
.day-anomaly-detail { margin: 12px 0; padding: 12px; border-left: 3px solid #d92d20; background: #fff3f2; }
.day-anomaly-detail > div + div { margin-top: 10px; padding-top: 10px; border-top: 1px solid #efb5b1; }
.day-anomaly-detail dl { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 5px 10px; margin: 8px 0 0; }
.day-anomaly-detail dt { color: var(--muted); }
.day-anomaly-detail dd { margin: 0; overflow-wrap: anywhere; }
.day-tags { display: flex; flex-wrap: wrap; gap: 4px; align-content: start; }
.day-card .day-tags .attendance-tag {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  flex-shrink: 1;
}
.attendance-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  box-shadow: inset 0 1px rgba(255,255,255,.8), 0 1px 1px rgba(31,41,51,.07);
  margin: 1px 2px 1px 0;
}
.attendance-teal { background: #e4f7f3; color: #08766d; border-color: #abdcd6; }
.attendance-cyan { background: #e2f5fb; color: #0b6f86; border-color: #9fd6e3; }
.attendance-gray { background: #f1f3f5; color: #606a78; border-color: #d7dce2; }
.attendance-green { background: #e9f8ee; color: #187244; border-color: #b9dfc8; }
.attendance-red { background: #ffeded; color: #b42318; border-color: #efb5b1; }
.attendance-yellow { background: #fff3cd; color: #8a5800; border-color: #e8cb76; }
.attendance-blue { background: #e8f1ff; color: #2459a6; border-color: #b9cff1; }
.attendance-purple { background: #f2eaff; color: #7040a0; border-color: #d4bcea; }
.attendance-redorange { background: #fff0e7; color: #b54708; border-color: #efc0a1; }
.attendance-grayblue { background: #edf2f7; color: #486176; border-color: #cbd6df; }
.attendance-empty { color: #98a2b3; font-size: 11px; }

.day-card strong {
  font-size: 13px;
  white-space: normal;
}

.day-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  white-space: normal;
}

.day-card.ok {
  background: #f1fbf6;
  border-color: #ccebdc;
}

.day-card.warn {
  background: #fff9ed;
  border-color: #f0dfb2;
}

.day-card.bad {
  background: #fff5f4;
  border-color: #efc0bb;
}

.rich-text {
  white-space: normal;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.check input {
  width: auto;
}

.confirm-box {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.confirm-panel {
  display: grid;
  gap: 14px;
}

.confirm-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.confirm-section + .confirm-section {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.confirm-section p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.confirm-section-stack {
  display: grid;
  justify-content: stretch;
}

.confirm-list {
  display: grid;
  gap: 8px;
}

.confirm-item {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid #e5e9f0;
  border-radius: 6px;
  background: #fbfcfe;
}

.confirm-department {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.confirm-count {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.filter-input-shell {
  display: flex;
  min-width: 0;
}

.filter-input-shell input {
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 6px 0 0 6px;
}

.filter-input-shell button {
  width: 38px;
  min-width: 38px;
  padding: 0;
  border-left: 0;
  border-radius: 0 6px 6px 0;
  font-size: 18px;
}

th.table-action-sticky,
td.table-action-sticky {
  position: sticky;
  z-index: 2;
  background: #fff;
  border-right: 1px solid #d8e0e8;
}

.employee-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 28px;
}

.employee-company-status {
  margin-top: 14px;
}

th.table-identity-sticky,
td.table-identity-sticky {
  position: sticky;
  z-index: 2;
  background: #fff;
  border-right: 1px solid #d8e0e8;
}

th.table-identity-sticky,
th.table-action-sticky { z-index: 4; }
th.table-identity-sticky,
th.table-action-sticky { background: #eef3f8; }
tbody tr:nth-child(even) td.table-identity-sticky,
tbody tr:nth-child(even) td.table-action-sticky { background: #fafbfd; }
tbody tr:hover td.table-identity-sticky,
tbody tr:hover td.table-action-sticky { background: #fff3cd; }
tbody tr.attendance-anomaly td.table-identity-sticky,
tbody tr.attendance-anomaly td.table-action-sticky { background: #fff0ef; }
tbody tr.attendance-anomaly:hover td.table-identity-sticky,
tbody tr.attendance-anomaly:hover td.table-action-sticky { background: #ffe4df; }
tbody tr.selected-row td.table-identity-sticky,
tbody tr.selected-row:nth-child(even) td.table-identity-sticky,
tbody tr.selected-row td.table-action-sticky,
tbody tr.selected-row:nth-child(even) td.table-action-sticky { background: #fff1b8; }
tbody tr.selected-row:hover td.table-identity-sticky,
tbody tr.selected-row:hover td.table-action-sticky { background: #ffe89a; }

th.table-action-sticky {
  background: #eef3f8;
}

.salary-adjust-button {
  min-width: 58px;
}

#view .viewport-table-wrap {
  overflow-x: scroll;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-color: #8291a6 #e8edf3;
  scrollbar-width: auto;
}

#view .viewport-table-wrap::-webkit-scrollbar {
  width: 13px;
  height: 13px;
}

#view .viewport-table-wrap::-webkit-scrollbar-track {
  background: #e8edf3;
  border-top: 1px solid #d8e0e9;
}

#view .viewport-table-wrap::-webkit-scrollbar-thumb {
  border: 3px solid #e8edf3;
  border-radius: 6px;
  background: #8291a6;
}

#view .viewport-table-wrap::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

.payroll-adjust-form {
  margin-top: 14px;
}

.calculated-preview {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.change-log-table {
  min-width: 640px;
}

.list {
  display: grid;
  gap: 8px;
}

.list button {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.list span {
  color: var(--muted);
}

details {
  margin-top: 12px;
}

summary {
  cursor: pointer;
  padding: 10px 0;
  font-weight: 700;
}

select[multiple] {
  min-height: 138px;
}

.row-actions,
.file-toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.file-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid #e5e9f0;
  border-radius: 6px;
  background: #f9fafb;
  overflow-wrap: anywhere;
}

.file-list button { width: 30px; height: 30px; padding: 0; flex: 0 0 auto; }

.source-file-actions {
  display: grid;
  gap: 6px;
  min-width: 240px;
}

.source-file-item {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  align-items: center;
  gap: 6px;
}

.source-file-item > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-file-item small { color: var(--muted); }

.security-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.security-summary > div {
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 7px rgba(18, 34, 52, 0.06);
}

.security-summary span,
.security-summary strong { display: block; }
.security-summary span { margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.security-summary strong { font-size: 20px; }

.option-fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.option-fieldset legend { padding: 0 6px; color: var(--ink); font-size: 13px; font-weight: 700; }
.option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.option-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #e2e7ee;
  border-radius: 6px;
  background: #fbfcfe;
  color: var(--ink);
}
.option-item input { width: auto; }

.role-domain {
  margin: 10px 0 0;
  border: 1px solid #e2e7ee;
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfe;
}

.role-domain legend {
  padding: 0 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.role-scope-row {
  display: grid;
  grid-template-columns: 130px minmax(150px, 0.7fr) minmax(220px, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.role-scope-row > span {
  font-weight: 700;
}

.role-scope-row select[multiple] {
  min-height: 72px;
}

.permission-list {
  display: grid;
  gap: 8px;
}

.permission-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e2e7ee;
  border-radius: 6px;
  background: #fbfcfe;
}

.permission-list span {
  color: var(--muted);
  text-align: right;
}

.view-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.view-tabs button {
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  font-weight: 700;
}

.view-tabs button.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.benefit-picker {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.picker-toolbar,
.calendar-rule-head,
.calendar-sync-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.picker-toolbar { margin-bottom: 10px; }
.benefit-employee-list {
  width: 100%;
  min-width: 0;
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.benefit-employee-head,
.benefit-employee-row {
  min-width: 980px;
  display: grid;
  grid-template-columns: 36px minmax(108px, 1fr) minmax(118px, 1fr) minmax(118px, 1fr) minmax(118px, 1fr) minmax(110px, 1fr) minmax(150px, 1.2fr);
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
}

.benefit-employee-head {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--line);
  background: #f5f7fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.benefit-employee-row {
  min-height: 42px;
  border-bottom: 1px solid #edf0f5;
  cursor: pointer;
}

.benefit-employee-row[hidden] { display: none; }
.benefit-employee-row:last-child { border-bottom: 0; }
.benefit-employee-row:hover { background: #fff7d6; }
.benefit-employee-row.selected {
  background: #eef5ff;
  box-shadow: inset 3px 0 0 var(--blue);
}
.benefit-employee-row.selected:hover { background: #fff3c4; }
.benefit-employee-row input { width: auto; margin: 0; }
.benefit-employee-row span { min-width: 0; overflow-wrap: anywhere; }
.benefit-employee-name { font-weight: 700; }
.calendar-rule-head { align-items: end; margin-bottom: 12px; }
.calendar-rule-head > label { min-width: 220px; }
.calendar-sync-info { margin-left: auto; color: var(--muted); font-size: 12px; }
.calendar-rule-table { max-height: 58vh; }
.calendar-rule-table table { min-width: 720px; }
.calendar-rule-table input { width: min(320px, 32vw); }
.calendar-rule-table select { min-width: 92px; }

@media (max-width: 760px) {
  .calendar-copy-filters { grid-template-columns: 1fr; }
  .login-card {
    grid-template-columns: 1fr;
  }

  .login-cover {
    min-height: 260px;
    padding: 28px;
  }

  .login-form {
    padding: 28px;
  }

  .shell {
    grid-template-columns: 1fr;
  }

  .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(286px, 88vw);
    height: 100dvh;
    transform: translateX(-102%);
    transition: transform 180ms ease;
    box-shadow: 12px 0 30px rgba(15, 23, 42, 0.22);
  }

  .side.mobile-open {
    transform: translateX(0);
  }

  .side-backdrop.visible {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(15, 23, 42, 0.42);
  }

  .mobile-nav-toggle {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    place-items: center;
    padding: 0;
    font-size: 20px;
  }

  .main {
    padding: 14px;
  }

  .page-head {
    flex-direction: row;
    align-items: center;
  }

  .searchbar {
    width: 100%;
    justify-content: stretch;
  }

  .searchbar input {
    min-width: 0;
    flex: 1 1 auto;
    width: 100%;
  }

  .filters,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .filters.employee-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .employee-filters > label,
  .employee-filters > .filter-control {
    width: 100%;
    max-width: none;
  }

  .employee-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .network-activity {
    top: 14px;
    right: 14px;
    max-width: calc(100vw - 74px);
  }

  .modal-backdrop {
    padding: 12px;
  }
}

@media (max-width: 620px) {
  .filters.employee-filters,
  .merge-select-grid,
  .merge-preview-identities,
  .merge-relation-grid {
    grid-template-columns: 1fr;
  }

  .merge-employee-results {
    position: fixed;
    top: auto;
    right: 20px;
    bottom: 20px;
    left: 20px;
    max-height: min(52vh, 420px);
  }

  .employee-merge-modal,
  .calendar-workspace-modal {
    width: calc(100vw - 12px);
    height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
  }

  .employee-merge-modal [data-merge-pane] { padding: 12px 12px 0; }
  .employee-merge-modal .modal-actions { margin-right: -12px; margin-left: -12px; padding-right: 12px; padding-left: 12px; }
  .merge-direction-grid { grid-template-columns: 1fr; }
  .merge-direction-arrow { min-height: 28px; transform: rotate(90deg); }
  .compact-calendar-filters { grid-template-columns: 1fr 1fr; }
  .calendar-workspace-toolbar { align-items: stretch; }
  .calendar-workspace-toolbar .month-stepper { width: 100%; grid-template-columns: 38px minmax(0, 1fr) 38px; }
  .calendar-workspace-toolbar .month-stepper input { width: 100%; }
  .calendar-template-layout { grid-template-columns: minmax(0, 1fr); }
  .template-settings { grid-template-columns: minmax(0, 1fr); }
  .template-settings .wide { grid-column: auto; }
  .template-scope-picker { max-height: 280px; }
  .template-calendar-panel .attendance-calendar-scroll { overflow-x: auto; }
  .template-calendar-panel .calendar-weekdays,
  .template-calendar-panel .calendar-grid { min-width: 784px; }

  .relation-row { grid-template-columns: 1fr; }
  .anomaly-summary-head { display: grid; }
  .anomaly-list button { grid-template-columns: auto minmax(0, 1fr); }
  .anomaly-list button > span:nth-child(3) { grid-column: 1 / -1; }
  .day-anomaly-detail dl { grid-template-columns: 1fr; }
  .time-condition-editor {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  }

  .time-condition-dates {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .confirm-section {
    align-items: stretch;
    flex-direction: column;
  }

  .confirm-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .confirm-item button {
    grid-column: 1 / -1;
  }

  .role-scope-row,
  .permission-list > div {
    grid-template-columns: 1fr;
    display: grid;
  }

  .permission-list span {
    text-align: left;
  }
}

@media (max-width: 420px) {
  .login {
    padding: 12px;
  }

  .login-form,
  .login-cover {
    padding: 22px;
  }

  .time-condition-editor {
    grid-template-columns: 1fr auto;
  }

  .time-condition-editor select[data-time-field] {
    grid-column: 1 / -1;
  }

  .month-query-control {
    grid-template-columns: 1fr;
  }
}

/* Shared dialog navigation; the close action remains on the far right. */
.modal-head h3 { flex: 1; min-width: 0; }
.modal-back { flex: 0 0 auto; white-space: nowrap; }
.modal-back[hidden] { display: none; }

/* Salary amendment: company cards are distinct from the formal history. */
.salary-card-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:16px}
.salary-card-item{background:#f1f6ff;border:1px solid #bdcee9;border-radius:12px;padding:20px;margin-bottom:16px}
.salary-card-item header{display:flex;gap:12px;justify-content:space-between;flex-wrap:wrap}
.salary-total{font-size:30px;font-weight:750;margin:16px 0}.salary-total small{font-size:13px;font-weight:400}
.salary-components{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.salary-components div{min-width:0}.salary-components dt{color:#526278}.salary-components dd{margin:4px 0;font-weight:600;overflow-wrap:anywhere}
.salary-pending{border-top:1px dashed #aabbd0;padding-top:12px;margin-top:12px}.salary-evidence{margin:16px 0;padding:12px;border:1px solid #d0d8e2}
[data-salary-total]{font-weight:700;background:#eef3fa} [data-salary-message]{white-space:pre-wrap}

/* Unresolved punch issues use yellow; attendance errors retain red priority. */
tr.punch-warning > td,
tbody tr.punch-warning:not(.attendance-anomaly):not(.selected-row):not(:hover) > td { background: #fff7d6; }
.punch-ledger { margin: 12px 0; }
.punch-ledger td { white-space: normal; min-width: 70px; }
