:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: #f6f7f4;
  color: #20231f;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f6f7f4;
}

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

.app-header {
  min-height: 58px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #ffffff;
  border-bottom: 1px solid #dfe3dc;
}

.brand {
  color: #18372a;
  font-weight: 700;
  text-decoration: none;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #5f675f;
  font-size: 14px;
}

.account-actions form {
  margin: 0;
}

.account-actions a {
  color: #2f6e4d;
}

.account-actions .header-command {
  color: #2f6e4d;
}

.page-shell {
  width: min(100% - 32px, 860px);
  margin: 0 auto;
  padding: 32px 0 56px;
}

.login-panel {
  width: min(100%, 420px);
  margin: 6vh auto 0;
  display: grid;
  gap: 28px;
}

.login-panel h1,
.page-heading h1 {
  margin: 4px 0 8px;
  font-size: 28px;
  line-height: 1.25;
}

.eyebrow {
  margin: 0;
  color: #2f6e4d;
  font-size: 13px;
  font-weight: 700;
}

.muted {
  margin: 0;
  color: #687068;
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 10px;
  padding-top: 22px;
  border-top: 1px solid #d9ded7;
}

.data-form {
  display: grid;
  gap: 10px;
  width: min(100%, 560px);
  padding-top: 20px;
  border-top: 1px solid #d9ded7;
}

.change-summary {
  width: min(100%, 560px);
  margin: 0 0 20px;
  padding: 14px 0;
  border-top: 1px solid #d9ded7;
  border-bottom: 1px solid #d9ded7;
}

.change-summary dt {
  color: #687068;
  font-size: 13px;
}

.change-summary dd {
  margin: 4px 0 12px;
  line-height: 1.6;
}

.change-summary dd:last-child {
  margin-bottom: 0;
}

.data-form label,
.data-form legend {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
}

.data-form input:not([type="radio"]),
.data-form select,
.data-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #bfc7bd;
  border-radius: 6px;
  background: #ffffff;
}

.data-form textarea {
  resize: vertical;
}

.data-form input:focus,
.data-form select:focus,
.data-form textarea:focus {
  outline: 3px solid #cce7d7;
  border-color: #2f6e4d;
}

.data-form .errorlist {
  margin: 0;
  padding: 0;
  list-style: none;
  color: #8b3d31;
  font-size: 14px;
}

.form-field {
  margin: 0;
  padding: 0;
  border: 0;
}

.form-field ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.form-field li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.login-form label {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
}

.login-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #bfc7bd;
  border-radius: 6px;
  background: #ffffff;
}

.login-form input:focus {
  outline: 3px solid #cce7d7;
  border-color: #2f6e4d;
}

.primary-button {
  min-height: 46px;
  margin-top: 12px;
  border: 0;
  border-radius: 6px;
  background: #246b49;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button {
  min-height: 46px;
  border: 1px solid #2f6e4d;
  border-radius: 6px;
  background: #ffffff;
  color: #245a3d;
  font-weight: 700;
  cursor: pointer;
}

.text-button {
  padding: 4px;
  border: 0;
  background: transparent;
  color: #8b3d31;
  cursor: pointer;
}

.error-message {
  padding: 10px 12px;
  border-left: 3px solid #b64e3d;
  background: #fff0ed;
  color: #7c2f25;
}

.page-heading {
  margin-bottom: 22px;
}

.team-list {
  border-top: 1px solid #d9ded7;
}

.record-list {
  border-top: 1px solid #d9ded7;
}

.record-row,
.employee-row {
  min-height: 76px;
  padding: 14px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #d9ded7;
}

.record-row {
  color: inherit;
  text-decoration: none;
}

.review-queue-row {
  justify-content: flex-start;
}

.review-row-link {
  min-width: 0;
  flex: 1;
  color: inherit;
  text-decoration: none;
}

.review-row-link strong,
.review-row-link small {
  display: block;
}

.review-row-link small {
  margin-top: 5px;
  color: #6b726b;
}

.review-queue-row > input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  accent-color: #246b49;
}

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

.form-actions .primary-button,
.form-actions .secondary-button {
  width: 100%;
  margin: 0;
}

.audit-event {
  padding: 14px 0;
  border-bottom: 1px solid #d9ded7;
}

.audit-event p {
  margin: 6px 0;
}

.audit-event pre {
  max-width: 100%;
  margin: 8px 0 0;
  padding: 10px;
  overflow-x: auto;
  border: 1px solid #d9ded7;
  border-radius: 4px;
  background: #ffffff;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.record-row strong,
.record-row small,
.employee-row strong,
.employee-row small {
  display: block;
}

.record-row small,
.employee-row small {
  margin-top: 5px;
  color: #6b726b;
}

.section-actions {
  display: flex;
  justify-content: flex-end;
  margin: -8px 0 14px;
}

.command-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 8px 13px;
  border-radius: 6px;
  background: #246b49;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

.command-link.secondary {
  border: 1px solid #2f6e4d;
  background: transparent;
  color: #2f6e4d;
}

.import-actions {
  justify-content: flex-start;
  margin: 0 0 12px;
}

.field-help {
  color: #687068;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  font-size: 14px;
}

.row-actions a {
  color: #2f6e4d;
}

.status-label {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 12px;
}

.status-label.pending {
  background: #fff2cf;
  color: #765310;
}

.status-label.confirmed {
  background: #dff1e5;
  color: #245a3d;
}

.status-label.neutral {
  background: #ecefeb;
  color: #515851;
}

.status-label.overdue {
  background: #f8e0dc;
  color: #863b30;
}

.status-label.ready {
  background: #dff1e5;
  color: #245a3d;
}

.status-label.waiting {
  background: #ecefeb;
  color: #515851;
}

.section-heading {
  margin: 36px 0 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 19px;
}

.inbox-list {
  border-top: 1px solid #d9ded7;
}

.inbox-row {
  min-height: 82px;
  padding: 14px 4px;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid #d9ded7;
}

.inbox-row:hover {
  color: #1f6544;
  background: #f0f5f0;
}

.inbox-date strong,
.inbox-date small,
.inbox-main strong,
.inbox-main small {
  display: block;
}

.inbox-date small,
.inbox-main small {
  margin-top: 5px;
  color: #6b726b;
}

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

.settings-section h2 {
  margin: 0 0 14px;
  font-size: 19px;
}

.history-section {
  margin-top: 38px;
}

.export-history {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid #d9ded7;
}

.export-record {
  padding: 14px 4px;
  display: grid;
  gap: 5px;
  border-bottom: 1px solid #d9ded7;
}

.export-record span,
.file-hash {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #687068;
  font-size: 13px;
  line-height: 1.6;
}

.month-close-actions {
  width: min(100%, 560px);
  display: grid;
  justify-items: start;
  gap: 14px;
}

.unlock-controls {
  width: 100%;
  margin: 2px 0 0;
  padding: 16px 0 0;
  display: grid;
  gap: 8px;
  border: 0;
  border-top: 1px solid #d9ded7;
}

.unlock-controls label {
  font-size: 14px;
  font-weight: 600;
}

.unlock-controls textarea {
  width: 100%;
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid #bcc5bc;
  border-radius: 6px;
  background: #ffffff;
}

.static-row {
  color: inherit;
}

.report-heading {
  margin-bottom: 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.report-heading h1 {
  margin: 4px 0 8px;
  font-size: 26px;
}

.review-notice {
  margin: 0 0 20px;
  padding: 10px 12px;
  border-left: 3px solid #a66d18;
  background: #fff2cf;
  color: #765310;
}

.report-draft-form {
  margin-top: 28px;
}

.report-entry-form {
  min-width: 0;
}

.report-shift-fieldset {
  margin: 0 0 24px;
  padding: 0 0 24px;
  border: 0;
  border-bottom: 1px solid #d9ded7;
}

.report-shift-fieldset legend {
  margin-bottom: 10px;
  font-weight: 700;
}

.report-shift-control {
  width: min(100%, 520px);
}

.employee-attendance-row {
  min-width: 0;
  margin: 0;
  padding: 14px 4px;
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  align-items: start;
  border: 0;
  border-bottom: 1px solid #d9ded7;
}

.attendance-status-control {
  width: min(100%, 390px);
  min-width: 0;
}

.attendance-status-control > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.attendance-status-control > div > div {
  min-width: 0;
}

.attendance-status-control label {
  min-height: 42px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #c7cec5;
  border-radius: 6px;
  background: #ffffff;
  color: #465048;
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
}

.attendance-status-control label:has(input:checked) {
  border-color: #2f6e4d;
  background: #e9f5ed;
  color: #214d37;
  font-weight: 700;
}

.attendance-status-control input {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  accent-color: #246b49;
}

.attendance-status-control input:disabled,
.confirmation-control input:disabled {
  opacity: 1;
}

.attendance-detail-fields,
.attendance-entry-summary {
  grid-column: 2;
  min-width: 0;
  margin-top: 10px;
}

.attendance-detail-fields {
  display: grid;
  gap: 12px;
}

.attendance-detail-fields [hidden] {
  display: none !important;
}

.attendance-hours-field {
  display: grid;
  grid-template-columns: minmax(120px, 180px);
  gap: 6px;
}

.attendance-hours-field label,
.field-label {
  color: #465048;
  font-size: 13px;
  font-weight: 700;
}

.attendance-hours-field input,
.leave-segment-row input,
.leave-segment-row select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #bfc7bd;
  border-radius: 6px;
  background: #ffffff;
}

.leave-segments {
  display: grid;
  gap: 8px;
}

.leave-segment-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 90px minmax(140px, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.add-segment-button {
  width: fit-content;
  margin-top: 2px;
  padding: 8px 12px;
}

.attendance-entry-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  color: #465048;
  font-size: 14px;
}

.proof-status {
  width: fit-content;
  font-size: 13px;
  font-weight: 700;
}

.proof-status.pending {
  color: #8a5c11;
}

.proof-status.uploaded {
  color: #246b49;
}

.sick-proof-section {
  margin-top: 34px;
}

.sick-proof-section h2 {
  margin: 0 0 14px;
  font-size: 19px;
}

.sick-proof-row {
  min-width: 0;
  padding: 14px 4px;
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #d9ded7;
}

.sick-proof-row strong,
.sick-proof-row small {
  display: block;
}

.sick-proof-row small {
  margin-top: 4px;
  color: #6b726b;
}

.sick-proof-row a {
  color: #2f6e4d;
}

.sick-proof-upload-form {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.sick-proof-upload-form label {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 700;
}

.sick-proof-upload-form input[type="file"] {
  min-width: 0;
  max-width: 100%;
}

.report-entry-form .errorlist {
  margin: 10px 0;
  padding: 0;
  list-style: none;
  color: #8b3d31;
  font-size: 14px;
}

.report-entry-form > .errorlist.nonfield {
  padding: 10px 12px;
  border-left: 3px solid #b64e3d;
  background: #fff0ed;
}

.draft-source {
  margin: 0 0 20px;
  padding: 10px 0;
  border-bottom: 1px solid #d9ded7;
  color: #465048;
}

.confirmation-control {
  min-height: 48px;
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: #214d37;
}

.confirmation-control input {
  width: 20px;
  height: 20px;
  accent-color: #246b49;
}

.report-actions {
  margin: 22px -4px 0;
  padding: 12px 4px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid #d9ded7;
  background: rgba(246, 247, 244, 0.96);
}

.report-actions .primary-button,
.report-actions .secondary-button {
  width: 100%;
  margin: 0;
}

.message-list {
  margin-bottom: 18px;
}

.app-reminders {
  margin: 0 0 18px;
  border-left: 3px solid #a66d18;
  background: #fff2cf;
}

.app-reminders a {
  min-height: 44px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  color: #765310;
  font-weight: 700;
  text-decoration: none;
}

.deadline-reminders {
  margin-bottom: 22px;
  border-top: 1px solid #dfd1ac;
}

.deadline-reminders h2 {
  margin: 14px 4px 4px;
  font-size: 17px;
}

.deadline-reminder {
  min-height: 62px;
  padding: 12px 4px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  color: #765310;
  text-decoration: none;
  border-bottom: 1px solid #dfd1ac;
}

.deadline-reminder span {
  color: #687068;
  font-size: 13px;
}

.save-status {
  margin: 0 0 18px;
  padding: 10px 12px;
  border-left: 3px solid #b64e3d;
  background: #fff0ed;
  color: #7c2f25;
}

.save-status[data-state="pending"] {
  border-left-color: #a66d18;
  background: #fff2cf;
  color: #765310;
}

.message {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-left: 3px solid #2f6e4d;
  background: #e9f5ed;
  color: #214d37;
}

.team-row {
  min-height: 72px;
  padding: 14px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid #d9ded7;
}

.team-row:hover {
  color: #1f6544;
  background: #f0f5f0;
}

.team-row strong,
.team-row small {
  display: block;
}

.team-row small {
  margin-top: 5px;
  color: #6b726b;
}

.empty-state {
  padding: 24px 0;
  color: #6b726b;
}

.back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: #2f6e4d;
}

@media (max-width: 520px) {
  .app-header {
    padding: 12px 16px;
    align-items: flex-start;
    flex-direction: column;
  }

  .account-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .account-actions > span {
    display: none;
  }

  .employee-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .employee-attendance-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .attendance-status-control {
    width: 100%;
  }

  .attendance-detail-fields,
  .attendance-entry-summary {
    grid-column: 1;
    margin-top: 0;
  }

  .leave-segment-row {
    grid-template-columns: minmax(0, 1fr) 88px;
  }

  .leave-segment-row input[name^="leave_details_"] {
    grid-column: 1 / -1;
  }

  .sick-proof-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .sick-proof-upload-form,
  .sick-proof-row > a {
    grid-column: 1 / -1;
  }

  .inbox-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .inbox-main {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .row-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .page-shell {
    width: min(100% - 28px, 860px);
    padding-top: 24px;
  }

  .login-panel {
    margin-top: 2vh;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .report-heading {
    align-items: flex-start;
  }
}
