:root {
  --bg: #eef6ff;
  --panel: #ffffff;
  --line: #d8e6f6;
  --line-strong: #b8d1ef;
  --blue: #1264d8;
  --blue-soft: #e6f1ff;
  --text: #172033;
  --muted: #66758a;
  --green: #079455;
  --red: #d92d20;
  --gray: #8a96a8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  height: 38px;
  padding: 0 16px;
  cursor: pointer;
}

button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

button.danger {
  color: var(--red);
  border-color: #fac5bf;
}

button.ghost {
  background: transparent;
}

button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  min-height: 38px;
  padding: 8px 10px;
  outline: none;
}

textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
}

label {
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-box {
  width: 420px;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 18px 42px rgba(18, 100, 216, .08);
  padding: 34px;
}

.brand {
  margin-bottom: 26px;
}

.brand h1 {
  margin: 0 0 8px;
  font-size: 26px;
}

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

.forgot-password-box {
  margin-top: 18px;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
  animation: forgotSlideIn .22s ease-out;
}

.forgot-link.active {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
}

.forgot-password-title {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.forgot-password-title strong {
  font-size: 18px;
}

.forgot-password-title span {
  color: var(--muted);
}

.forgot-step {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: #f7fbff;
  color: var(--muted);
  padding: 10px 12px;
  margin-bottom: 14px;
}

.forgot-step b {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #dbeafe;
  color: var(--blue);
}

.forgot-step.active {
  border-color: #9fc5f4;
  color: var(--text);
}

.forgot-step.done b {
  background: #d1fadf;
  color: var(--green);
}

.forgot-next {
  margin-top: 16px;
  animation: forgotSlideIn .2s ease-out;
}

.forgot-message {
  margin-top: 14px;
}

@keyframes forgotSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.field {
  margin-bottom: 16px;
}

.field input,
.field select {
  width: 100%;
}

.app-shell {
  min-height: 100vh;
}

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

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

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.layout {
  display: grid;
  grid-template-columns: 112px 1fr;
  min-height: calc(100vh - 66px);
}

.side {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 16px 10px;
}

.side button {
  width: 100%;
  border: 1px solid transparent;
  text-align: center;
  min-height: 58px;
  padding: 8px 6px;
}

.side button.active {
  border-color: #9fc5f4;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.nav-icon-button {
  display: grid;
  justify-items: center;
  gap: 3px;
  margin-bottom: 8px;
  line-height: 1.2;
}

.content {
  padding: 28px;
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 18px;
}

.section-head {
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

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

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

.section-body {
  padding: 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 16px;
}

.grid.three {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  border: 1px solid var(--line);
  background: #f7fbff;
  padding: 14px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.card {
  border: 1px solid var(--line);
  background: #fff;
  padding: 16px;
}

.card h3 {
  margin: 0 0 10px;
}

.code-block {
  border: 1px solid var(--line);
  background: #f8fbff;
  color: var(--text);
  margin: 10px 0;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-all;
}

.performance-modal {
  width: min(1120px, calc(100vw - 44px));
}

.mase-modal {
  width: min(1360px, calc(100vw - 44px));
}

.wide-modal {
  width: min(1480px, calc(100vw - 44px));
}

.performance-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
}

.performance-box {
  border: 1px solid var(--line);
  background: #fff;
  padding: 16px;
  min-height: 176px;
}

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

.performance-box-head strong {
  font-size: 17px;
}

.performance-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.performance-box input[type="file"] {
  width: 100%;
}

.upload-status {
  min-height: 38px;
  color: var(--muted);
  padding: 10px 0;
  word-break: break-word;
}

.extract-status {
  border: 1px solid var(--line);
  background: #f7fbff;
  color: #0b356e;
  line-height: 1.45;
  padding: 8px 10px;
  min-height: 38px;
}

.wide-action {
  width: 100%;
  margin-top: 16px;
}

.settle-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.settle-action-row .wide-action {
  margin-top: 16px;
}

.settle-box p {
  color: var(--muted);
  min-height: 62px;
  line-height: 1.6;
  margin: 0;
}

.performance-rules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.mase-rules {
  grid-template-columns: minmax(520px, 1.35fr) minmax(420px, .95fr);
}

.mase-status-box {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mase-status-box .notice,
.mase-status-box .error,
.mase-status-box table {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.schedule-modal {
  width: min(1180px, 96vw);
}

.schedule-calendar-panel {
  margin-top: 22px;
  border: 1px solid var(--line);
  background: #fbfdff;
  padding: 18px;
}

.schedule-calendar-head,
.schedule-month-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.schedule-calendar-head h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.schedule-calendar-head p {
  margin: 0;
  color: var(--muted);
}

.month-field {
  min-width: 210px;
  margin-bottom: 0;
}

.settlement-month-field {
  max-width: 260px;
}

.settlement-month-field select {
  min-height: 42px;
  font-weight: 800;
}

.settlement-month-field small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.4;
}

.settlement-month-strip {
  margin-bottom: 14px;
}

.schedule-month-title {
  margin: 20px 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.schedule-month-title strong {
  color: #ef3340;
  font-size: 28px;
}

.schedule-month-title span {
  color: var(--muted);
  font-weight: 700;
}

.schedule-weekdays,
.schedule-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.schedule-weekdays {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.schedule-weekdays span {
  padding: 10px 4px;
}

.schedule-calendar-grid {
  gap: 0;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
}

.schedule-day {
  height: 98px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 8px 4px;
  background: #fff;
  color: var(--text);
  text-align: center;
}

.schedule-day strong {
  font-size: 28px;
  line-height: 1;
}

.schedule-day span {
  font-weight: 800;
}

.schedule-day small {
  color: var(--muted);
  font-size: 11px;
}

.schedule-day.rest {
  background: #fff1f0;
  color: var(--red);
}

.schedule-day.rest small {
  color: #b42318;
}

.schedule-day.work {
  background: #fff;
}

.schedule-day.empty {
  background: #f7fbff;
  cursor: default;
}

.mase-progress {
  border-color: var(--blue);
  background: #dbeafe;
  color: #0b356e;
  font-weight: 700;
}

.rule-input-box,
.rule-list-box,
.performance-result {
  border: 1px solid var(--line);
  background: #fff;
  padding: 16px;
}

.rule-input-box h3,
.rule-list-box h3 {
  margin: 0 0 12px;
}

.rule-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.rule-list-box ol {
  margin: 0;
  padding-left: 0;
  counter-reset: rule-counter;
  list-style: none;
}

.rule-list-box li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  counter-increment: rule-counter;
  align-items: flex-start;
}

.rule-list-box li::before {
  content: counter(rule-counter) ".";
  color: var(--blue);
  font-weight: 700;
  min-width: 28px;
  padding-top: 2px;
}

.rule-list-box li span {
  flex: 1;
  line-height: 1.5;
  white-space: normal;
}

.rule-list-box li:last-child {
  border-bottom: 0;
}

.rule-list-box li.overridden span {
  color: var(--muted);
}

.rule-list-box b {
  display: inline-block;
  color: var(--blue);
  font-size: 12px;
  margin-left: 8px;
  font-weight: 700;
}

.rule-list-box em {
  color: var(--muted);
  font-style: normal;
  min-width: 42px;
  text-align: center;
}

.performance-result {
  margin-top: 16px;
}

.performance-result pre {
  margin: 12px 0 0;
  white-space: pre-wrap;
  font-size: 16px;
  line-height: 1.8;
}

.nested-backdrop {
  z-index: 72;
  background: rgba(23, 32, 51, .38);
}

.salary-detail-modal .section-body {
  background: #f7fbff;
}

.salary-detail-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.salary-detail-card {
  border: 1px solid var(--line);
  background: #fff;
  padding: 16px;
}

.salary-detail-card-head,
.salary-detail-summary,
.correction-row,
.compact-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.salary-detail-card h3,
.compact-head h3 {
  margin: 0;
}

.salary-detail-card small,
.correction-row small {
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

.salary-detail-total {
  text-align: right;
  color: var(--muted);
}

.salary-detail-total strong {
  display: block;
  color: var(--text);
  font-size: 20px;
  margin-top: 4px;
}

.salary-detail-summary {
  justify-content: flex-start;
  flex-wrap: wrap;
  color: #0b356e;
  font-weight: 700;
  margin: 14px 0 8px;
}

.salary-detail-lines {
  margin: 0;
  padding-left: 20px;
  line-height: 1.75;
}

.salary-detail-lines li {
  margin: 2px 0;
}

.extract-detail-modal {
  width: min(980px, calc(100vw - 44px));
}

.extract-paper {
  width: min(820px, 100%);
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  padding: 22px;
  min-height: 760px;
}

.extract-group {
  border: 1px solid var(--line);
  margin-top: 14px;
  background: #fff;
}

.extract-group-head {
  background: #f1f7ff;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.extract-group-head h3 {
  margin: 0;
  font-size: 18px;
}

.extract-group-head small {
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

.extract-field-list {
  display: grid;
  gap: 0;
}

.extract-field {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

.extract-field:last-child {
  border-bottom: 0;
}

.extract-field input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.extract-field strong {
  display: block;
}

.extract-field em {
  color: #0b356e;
  font-style: normal;
  display: inline-block;
  margin-top: 3px;
}

.extract-field small {
  color: var(--muted);
  display: block;
  margin-top: 4px;
  line-height: 1.45;
}

.extract-field.readonly {
  background: #fafcff;
}

.salary-correction-panel {
  border: 1px solid #b8d5ff;
  background: #eaf4ff;
  padding: 16px;
  margin-top: 16px;
}

.salary-correction-panel p {
  margin: 10px 0 12px;
  color: #0b356e;
  line-height: 1.65;
}

.correction-list {
  display: grid;
  gap: 10px;
}

.correction-row {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 12px;
  align-items: center;
}

.form-row {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.form-row .field {
  min-width: 180px;
  margin-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 920px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: #f6faff;
  color: #2f3b4e;
}

td input,
td select {
  min-width: 120px;
}

.scorer-bonus-table table {
  min-width: 0;
  table-layout: fixed;
}

.modal.performance-modal.wide-modal {
  width: min(1760px, calc(100vw - 12px));
  max-height: 94vh;
}

.modal.performance-modal.wide-modal .section-body {
  padding: 16px;
}

.scorer-bonus-table th,
.scorer-bonus-table td {
  padding: 10px 8px;
}

.scorer-bonus-table th:first-child,
.scorer-bonus-table td:first-child {
  width: 280px;
}

.scorer-bonus-table th:nth-child(n + 2):nth-child(-n + 5),
.scorer-bonus-table td:nth-child(n + 2):nth-child(-n + 5) {
  width: 126px;
}

.scorer-bonus-table th:nth-child(6),
.scorer-bonus-table td:nth-child(6) {
  width: 158px;
}

.scorer-bonus-table th:nth-child(7),
.scorer-bonus-table td:nth-child(7) {
  width: 150px;
}

.scorer-bonus-table th:nth-child(8),
.scorer-bonus-table td:nth-child(8) {
  width: 118px;
}

.scorer-bonus-table .mini-input,
.scorer-bonus-table .readonly-money-box {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.bonus-switch-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.bonus-switch-row label {
  border: 1px solid var(--line);
  background: #f8fbff;
  padding: 12px;
}

.bonus-switch-row span {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}

.bonus-switch-row select {
  width: 100%;
}

.mini-input {
  min-width: 110px;
  max-width: 150px;
  height: 38px;
  padding: 8px 10px;
}

.money-input {
  text-align: right;
}

.readonly-money-box {
  min-width: 110px;
  height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #f8fbff;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  font-weight: 800;
}

.muted-money-box {
  color: var(--muted);
  background: #f4f7fb;
}

.bonus-person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bonus-person > div {
  min-width: 0;
}

.bonus-person strong,
.bonus-person small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bonus-person small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.bonus-person-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.bonus-row-switch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  background: #f8fbff;
  color: #0f2746;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.bonus-row-switch input {
  min-width: 0;
  width: 16px;
  height: 16px;
}

.bonus-avatar {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line-strong);
  object-fit: cover;
  background: #f6faff;
  flex: 0 0 auto;
}

.bonus-avatar.placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.scorer-bonus-table td small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.scorer-bonus-actions {
  position: sticky;
  bottom: -16px;
  z-index: 2;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 12px 0 0;
  margin-top: 8px;
}

.employee-code-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-width: 46px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  background: #f6faff;
  color: var(--muted);
  cursor: grab;
  user-select: none;
  font-size: 12px;
}

.drag-handle:active {
  cursor: grabbing;
}

tr.dragging {
  opacity: .55;
  background: var(--blue-soft);
}

.employee-code-cell input {
  min-width: 150px;
}

.employee-code-cell input.employee-mobile-password {
  min-width: 180px;
}

.employee-avatar,
.detail-avatar {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line-strong);
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f6faff;
  color: var(--muted);
  font-size: 12px;
}

.employee-avatar-upload {
  width: 50px;
  height: 50px;
  padding: 0;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.employee-avatar-upload:hover .employee-avatar,
.employee-avatar-upload:focus-visible .employee-avatar {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-soft);
}

.detail-avatar {
  width: 96px;
  height: 96px;
}

.avatar-editor {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

button.mini-action {
  height: 32px;
  padding: 0 10px;
  white-space: nowrap;
  background: var(--blue-soft);
  border-color: var(--line-strong);
  color: var(--blue);
  font-weight: 700;
}

.status {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  color: var(--gray);
  background: #f8fafc;
}

.status.ok {
  color: var(--green);
  background: #ecfdf3;
  border-color: #abefc6;
}

.status.bad {
  color: var(--red);
  background: #fef3f2;
  border-color: #fecdca;
}

.notice {
  border: 1px solid var(--line-strong);
  background: var(--blue-soft);
  color: #0b356e;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.salary-flow-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.salary-flow-step {
  border: 1px solid var(--line);
  background: #fff;
  min-height: 72px;
  padding: 12px;
  display: grid;
  align-content: center;
  gap: 5px;
}

.salary-flow-step strong {
  font-size: 15px;
}

.salary-flow-step span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.salary-flow-step.done {
  border-color: #9ad5a5;
  background: #f0fff4;
}

.salary-flow-step.active {
  border-color: #8fb5e5;
  background: #eaf4ff;
}

.ai-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
}

.ai-card {
  height: 118px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: 1fr auto;
  align-items: center;
  gap: 8px 12px;
  padding: 14px;
  text-align: left;
}

.ai-card:hover {
  border-color: var(--line-strong);
  background: #fbfdff;
}

.ai-icon {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

.ai-card strong {
  font-size: 16px;
}

.ai-card .status {
  grid-column: 1 / -1;
  width: max-content;
}

.link-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--blue-soft);
  color: var(--blue);
  padding: 0 14px;
  text-decoration: none;
  font-weight: 700;
}

.danger-zone {
  border-top: 1px solid #fac5bf;
  margin-top: 24px;
  padding-top: 18px;
}

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

.error {
  color: var(--red);
  margin-top: 10px;
}

.success {
  color: var(--green);
  margin-top: 10px;
}

.bottom-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.left-actions,
.right-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 420px;
}

.inline-check {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  margin: 0;
  color: var(--text);
}

.inline-check input {
  min-height: 0;
}

.small-input {
  width: 58px;
  min-width: 58px;
}

.signature-field {
  grid-column: 1 / -1;
}

#bossSignatureCanvas {
  width: 360px;
  max-width: 100%;
  height: 110px;
  border: 1px solid var(--line);
  background: #fff;
  display: block;
  touch-action: none;
  margin-bottom: 10px;
}

.profile-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.profile-group-card {
  min-height: 128px;
}

.profile-group-card strong {
  font-size: 18px;
}

.grouped-options {
  grid-template-columns: repeat(3, minmax(170px, 1fr));
}

.profile-icon-card {
  min-height: 104px;
  border: 1px solid #cfe0f5;
  background: #fff;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
}

.profile-icon-card:hover {
  border-color: #8fb9ec;
  background: #f7fbff;
}

.profile-icon-card strong {
  font-size: 16px;
}

.profile-icon-card small {
  color: var(--muted);
  line-height: 1.4;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 420px;
}

.lang-buttons {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.lang-buttons button {
  min-height: 36px;
  padding: 8px 12px;
}

.lang-buttons button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 32, 51, .28);
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal {
  background: #fff;
  border: 1px solid var(--line);
  width: min(860px, 96vw);
  max-height: 88vh;
  overflow: auto;
  box-shadow: 0 22px 60px rgba(18, 100, 216, .18);
}

.modal.wide {
  width: min(1120px, 96vw);
}

.modal.profile-modal {
  width: min(640px, 94vw);
}

.modal.payslip-modal {
  width: min(1280px, 98vw);
}

.mobile-switch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
}

.mobile-switch-all {
  width: 180px;
  margin: 0 0 12px;
}

.mobile-switch-grid button {
  min-height: 58px;
  display: grid;
  gap: 4px;
  align-content: center;
  font-weight: 700;
}

.mobile-switch-grid button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.mobile-switch-grid small {
  font-weight: 400;
  opacity: .8;
}

.mobile-switch-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.payslip-modal-body {
  padding: 14px;
}

.payslip-frame {
  width: 100%;
  height: 68vh;
  border: 1px solid var(--line);
  background: #fff;
}

.rules-panel {
  border: 1px solid var(--line-strong);
  background: #fbfdff;
  margin-bottom: 14px;
  padding: 14px;
}

.rules-editor textarea {
  min-height: 88px;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.rule-card {
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}

.rule-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.rule-title span {
  color: var(--muted);
}

.rule-value {
  color: #0b356e;
  margin-bottom: 8px;
}

.rule-value-editor {
  display: grid;
  gap: 6px;
  color: #0b356e;
  font-weight: 700;
  margin-bottom: 8px;
}

.rule-value-editor input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  font-size: 15px;
  color: var(--text);
  background: #fff;
}

.rule-value-editor input:focus {
  outline: 2px solid rgba(28, 103, 216, 0.22);
  border-color: var(--blue);
}

.rule-text,
.rule-custom {
  line-height: 1.55;
  white-space: normal;
}

.rule-text span {
  color: var(--muted);
}

.rule-custom,
.rule-learned {
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 10px;
}

.rule-custom {
  color: var(--green);
}

.rule-learned {
  color: #0b356e;
  background: var(--blue-soft);
  padding: 10px;
}

.rule-learned span {
  color: var(--muted);
}

.platform-box {
  border: 1px solid var(--line);
  padding: 12px;
  margin: 0;
}

.platform-box legend {
  font-weight: 700;
  color: var(--text);
}

.cpf-reminder {
  font-size: 12px;
  margin-top: 6px;
  font-weight: 700;
}

.cpf-reminder.red { color: var(--red); }
.cpf-reminder.green { color: var(--green); }
.cpf-reminder.blue { color: var(--blue); }
.cpf-reminder.yellow { color: #b7791f; }

.cpf-name-red input {
  border-color: var(--red);
  background: #fff5f5;
}

.cpf-name-yellow input {
  border-color: #f6c453;
  background: #fffaf0;
}

.cpf-name-green input {
  border-color: var(--green);
  background: #f0fff4;
}

.cpf-status {
  font-weight: 700;
  color: var(--muted);
}

.cpf-status.ready {
  color: var(--blue);
}

.cpf-status.legacy,
.cpf-status.missing_birth {
  color: #b7791f;
}

input[readonly] {
  background: #f8fbff;
  color: var(--muted);
}

.ai-helper {
  position: fixed;
  right: 0;
  top: 168px;
  z-index: 80;
  display: flex;
  align-items: flex-start;
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

.ai-helper.open {
  right: 18px;
  top: 120px;
}

.ai-helper-tab {
  writing-mode: vertical-rl;
  height: auto;
  min-height: 92px;
  padding: 12px 8px;
  border-radius: 8px 0 0 8px;
  border: 1px solid #9fc5f4;
  border-right: 0;
  background: #1264d8;
  color: #fff;
  box-shadow: 0 8px 22px rgba(18, 100, 216, .22);
}

.ai-helper.open .ai-helper-tab {
  display: none;
}

.ai-helper-panel {
  display: none;
  width: 440px;
  min-width: 340px;
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 70px);
  overflow: auto;
  resize: horizontal;
  background: #fff;
  border: 1px solid #b8d1ef;
  box-shadow: 0 14px 36px rgba(20, 52, 92, .16);
  padding: 14px;
}

.ai-helper.open .ai-helper-panel {
  display: block;
}

.ai-helper-panel h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.ai-helper-title {
  cursor: move;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.ai-helper-title h3 {
  margin: 0;
}

.ai-helper-title button {
  min-height: 32px;
  height: 32px;
  padding: 0 10px;
}

.ai-helper-panel p {
  margin: 0 0 8px;
  color: var(--muted);
}

.ai-helper-panel ul {
  margin: 0 0 12px 18px;
  padding: 0;
  line-height: 1.7;
}

.assistant-chat {
  display: grid;
  gap: 8px;
  margin: 10px 0;
  min-height: 220px;
  max-height: 48vh;
  overflow: auto;
  align-content: start;
}

.assistant-msg {
  border: 1px solid #d8e6f7;
  background: #f7fbff;
  padding: 10px;
  font-size: 13px;
  line-height: 1.55;
}

.assistant-msg.user {
  background: #eef5ff;
  border-color: #b8d1ef;
  font-weight: 700;
  justify-self: end;
  max-width: 88%;
}

.assistant-msg.assistant {
  justify-self: start;
  max-width: 92%;
}

.assistant-form {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.assistant-form textarea {
  min-height: 96px;
  resize: vertical;
}

.assistant-actions,
.assistant-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.assistant-quick {
  margin-bottom: 12px;
}

.assistant-actions button,
.assistant-quick button {
  padding: 8px 10px;
  min-height: 34px;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .side {
    display: flex;
    overflow-x: auto;
    padding: 0;
  }

  .side button {
    width: auto;
    min-width: 150px;
    border-left: 0;
    border-bottom: 3px solid transparent;
  }

  .side button.active {
    border-bottom-color: var(--blue);
  }

  .grid,
  .grid.three,
  .stat-grid,
  .mase-rules {
    grid-template-columns: 1fr;
  }

  .schedule-calendar-panel {
    padding: 12px;
  }

  .schedule-day {
    height: 72px;
    padding: 6px 2px;
  }

  .schedule-day strong {
    font-size: 22px;
  }

  .schedule-day small {
    display: none;
  }

  .ai-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .ai-helper {
    top: auto;
    bottom: 18px;
  }
}

.admin-switch-card {
  text-align: center;
}

.admin-switch-card.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.admin-switch-card.active small {
  color: #fff;
}

.exam-rule-stages {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}

.exam-rule-stage {
  border: 1px solid var(--border);
  background: #fff;
  padding: 16px;
}

.exam-rule-stage-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.exam-rule-items {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.exam-rule-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.warning-text {
  color: #d93025;
  font-weight: 700;
}

.annual-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.annual-summary.compact {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}

.annual-summary > div {
  border: 1px solid var(--border);
  background: #f8fbff;
  padding: 14px;
}

.annual-summary span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.annual-summary strong {
  font-size: 22px;
}

.annual-people {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.annual-person {
  border: 1px solid var(--border);
  background: #fff;
  padding: 14px 10px;
  min-height: 150px;
  display: grid;
  justify-items: center;
  gap: 6px;
  cursor: pointer;
}

.annual-person.active {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(18, 100, 216, .18);
}

.annual-person.good em {
  color: #0f9d58;
}

.annual-person.danger em {
  color: #d93025;
}

.annual-avatar {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  overflow: hidden;
  background: #eaf3ff;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-weight: 800;
}

.annual-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.annual-person small,
.annual-person em {
  color: var(--muted);
  font-style: normal;
}

.annual-detail {
  border: 1px solid var(--border);
  background: #fff;
  margin-top: 18px;
  padding: 16px;
}

.annual-adjust {
  margin-top: 14px;
}

.boss-alert-box {
  border-color: #f5c26b;
  background: #fffaf0;
}

.boss-alert-row {
  align-items: center;
}

.boss-alert-row .mini-avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 8px;
}

.mobile-link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 260px;
}

.mobile-link-actions button {
  white-space: nowrap;
}

.mobile-link-actions .muted-action {
  color: var(--muted);
  background: #fff;
}

.target-bonus-list {
  display: grid;
  gap: 14px;
  margin: 14px 0;
}

.target-bonus-card {
  border: 1px solid var(--border);
  background: #fff;
  padding: 16px;
}

.target-bonus-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.target-bonus-head h4 {
  margin: 0 0 5px;
}

.target-bonus-head small,
.score-money-item small {
  color: var(--muted);
}

.target-bonus-total {
  min-width: 170px;
  text-align: right;
}

.target-bonus-total span,
.target-bonus-total strong {
  display: block;
}

.target-bonus-total strong {
  margin-top: 5px;
  color: #0b3f7f;
}

.attendance-source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 14px 0;
  background: var(--border);
  border: 1px solid var(--border);
}

.attendance-source-grid > div {
  min-width: 0;
  background: #f8fbff;
  padding: 10px 12px;
}

.attendance-source-grid span,
.attendance-source-grid strong {
  display: block;
}

.attendance-source-grid span {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 5px;
}

.score-money-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.score-money-item {
  display: grid;
  grid-template-columns: 1fr minmax(90px, 120px);
  align-items: center;
  gap: 8px 10px;
  border: 1px solid var(--border);
  padding: 10px;
}

.score-money-item.deduction-item {
  border-color: #f2c7c4;
  background: #fffafa;
}

.score-money-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.score-money-switch input {
  width: 20px;
  height: 20px;
  margin: 0;
}

.score-money-input {
  min-width: 0;
  width: 100%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.score-money-item small {
  grid-column: 1 / -1;
}

.one-time-adjustment-note {
  margin-top: 10px;
}

.salary-direct-adjust {
  margin: 14px 0;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.salary-direct-adjust .compact-head {
  align-items: center;
  margin-bottom: 10px;
}

.salary-direct-adjust h4 {
  margin: 0 0 5px;
}

.salary-direct-adjust small,
.one-time-adjustment-note {
  color: var(--muted);
}

.compact-attendance-grid {
  margin-top: 10px;
}

@media (max-width: 900px) {
  .salary-flow-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .annual-summary,
  .annual-summary.compact,
  .annual-people {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .attendance-source-grid,
  .score-money-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .salary-flow-panel {
    grid-template-columns: 1fr;
  }

  .settle-action-row,
  .salary-detail-card-head,
  .correction-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .salary-detail-total {
    text-align: left;
  }

  .target-bonus-head {
    display: grid;
  }

  .target-bonus-total {
    min-width: 0;
    text-align: left;
  }

  .attendance-source-grid,
  .score-money-grid {
    grid-template-columns: 1fr;
  }

  .score-money-item {
    grid-template-columns: 1fr 110px;
  }

  .salary-direct-adjust .compact-head {
    display: grid;
    gap: 10px;
  }
}
