:root {
  color-scheme: light;
  --ink: #202b36;
  --muted: #667789;
  --line: #dce5ed;
  --paper: #ffffff;
  --wash: #f3f7fa;
  --blue: #1769aa;
  --blue-dark: #0f4e82;
  --green: #1f8a5b;
  --green-soft: #e8f6ef;
  --yellow: #b7791f;
  --yellow-soft: #fff4d6;
  --red: #bd2d2d;
  --red-soft: #fde7e7;
  --shadow: 0 18px 44px rgba(32, 43, 54, 0.13);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px clamp(14px, 4vw, 44px);
  border-bottom: 1px solid rgba(220, 229, 237, 0.86);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  min-width: 0;
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

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

.brand strong,
.brand small {
  display: block;
  line-height: 1.1;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
}

.auth-actions,
.user-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.user-actions span {
  max-width: 120px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-tabs {
  position: sticky;
  top: 67px;
  z-index: 18;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px clamp(14px, 4vw, 32px);
  background: rgba(243, 247, 250, 0.94);
  backdrop-filter: blur(12px);
}

.page-tabs a {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}

.page-tabs a span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 7px;
  background: #eef4f8;
  color: var(--blue);
}

.page-tabs a.active {
  border-color: #9bc4e2;
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(23, 105, 170, 0.1);
}

.primary-btn,
.ghost-btn {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  font-weight: 800;
}

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

.primary-btn:hover {
  background: var(--blue-dark);
}

.ghost-btn {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost-btn:hover {
  border-color: #aac4d8;
}

.wide {
  width: 100%;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px clamp(14px, 4vw, 32px) 54px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-panel {
  display: grid;
  gap: 14px;
  align-items: start;
  padding: clamp(22px, 5vw, 42px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.eyebrow {
  margin: 0;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  overflow-wrap: normal;
}

h1 {
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.04;
}

h2 {
  font-size: 24px;
}

.hero-panel p:not(.eyebrow),
.step-copy {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.start-btn {
  width: min(280px, 100%);
  min-height: 50px;
  margin-top: 4px;
}

.section {
  margin-top: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.section.compact {
  padding-top: 18px;
}

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

.section-head > div {
  display: grid;
  gap: 6px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

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

.summary-grid div {
  display: grid;
  gap: 3px;
  min-height: 70px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  padding: 12px;
}

.summary-grid strong {
  font-size: 24px;
}

.summary-grid span {
  color: var(--muted);
  font-size: 13px;
}

.member-list,
.record-list {
  display: grid;
  gap: 10px;
}

.member-list {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.calendar-overview,
.supervise-calendar {
  display: grid;
  gap: 10px;
}

.supervise-calendar {
  margin-bottom: 18px;
}

.calendar-row {
  display: grid;
  grid-template-columns: 172px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-left: 6px solid var(--muted);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.calendar-row.green {
  border-left-color: var(--green);
  background: var(--green-soft);
}

.calendar-row.yellow {
  border-left-color: var(--yellow);
  background: var(--yellow-soft);
}

.calendar-row.red {
  border-left-color: var(--red);
  background: var(--red-soft);
}

.calendar-person {
  display: grid;
  gap: 5px;
  align-content: center;
  min-width: 0;
}

.calendar-person strong {
  overflow-wrap: anywhere;
  font-size: 17px;
}

.calendar-person .status-pill {
  width: fit-content;
}

.calendar-person small {
  color: var(--muted);
}

.day-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(48px, 1fr));
  gap: 7px;
  min-width: 0;
}

.day-cell {
  display: grid;
  min-height: 58px;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

button.day-cell {
  color: var(--ink);
}

.day-cell strong {
  font-size: 18px;
  line-height: 1;
}

.day-cell.done {
  border-color: rgba(31, 138, 91, 0.45);
  background: #fff;
  color: var(--green);
}

.day-cell.fail {
  border-color: rgba(189, 45, 45, 0.42);
  background: #fff;
  color: var(--red);
}

.day-cell.today {
  border-color: rgba(183, 121, 31, 0.45);
  background: rgba(255, 244, 214, 0.74);
}

.day-cell.miss {
  background: rgba(255, 255, 255, 0.46);
}

.day-cell.inactive {
  opacity: 0.42;
  background: transparent;
}

.subhead {
  margin: 4px 0 12px;
  font-size: 18px;
}

.member-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
  min-height: 118px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--muted);
  border-radius: 8px;
  background: #fff;
}

.member-row.green {
  border-left-color: var(--green);
  background: var(--green-soft);
}

.member-row.yellow {
  border-left-color: var(--yellow);
  background: var(--yellow-soft);
}

.member-row.red {
  border-left-color: var(--red);
  background: var(--red-soft);
}

.member-name {
  min-width: 0;
  font-size: 17px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.member-sub,
.failure-count {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.member-side {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.status-pill {
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-weight: 900;
}

.checkin-shell {
  display: grid;
  gap: 18px;
  max-width: 620px;
  min-height: calc(100vh - 168px);
  margin: 0 auto;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: clamp(18px, 4vw, 28px);
}

.step-head {
  display: flex;
  gap: 14px;
  align-items: center;
}

.step-head > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.step-dots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.step-dots span {
  height: 7px;
  border-radius: 999px;
  background: #dde8ef;
}

.step-dots span.active {
  background: var(--blue);
}

.checkin-step {
  display: none;
  gap: 16px;
}

.checkin-step.active {
  display: grid;
}

.time-row,
.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 112px;
  padding: 12px;
  resize: vertical;
  line-height: 1.6;
}

.upload-card {
  position: relative;
  gap: 8px;
  min-height: 128px;
  justify-content: center;
  border: 1px dashed #9eb6c8;
  border-radius: 8px;
  background: #f8fbfd;
  padding: 18px;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.upload-card span {
  font-size: 18px;
}

.upload-card small {
  color: var(--muted);
}

.upload-card input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-card::after {
  content: "点击上传，也可以直接粘贴截图";
  display: block;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  background: #fff;
  color: var(--blue);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 900;
}

.upload-card:hover {
  border-color: var(--blue);
  background: #eef7fc;
}

.upload-card.required {
  border-color: var(--yellow);
  background: var(--yellow-soft);
}

.upload-card.has-file {
  border-color: var(--green);
  background: var(--green-soft);
}

.upload-card.has-file::after {
  content: "已选择：" attr(data-file);
  color: var(--green);
}

.clear-upload {
  position: relative;
  z-index: 2;
  display: none;
  width: fit-content;
  max-width: 100%;
  min-height: 34px;
  border: 1px solid rgba(31, 138, 91, 0.36);
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 900;
}

.upload-card.has-file .clear-upload {
  display: inline-grid;
  place-items: center;
}

.form-message {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
}

.form-message.error {
  color: var(--red);
}

.form-message.ok {
  color: var(--green);
}

.record-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  color: inherit;
  text-align: left;
}

.record-row:hover {
  border-color: #aac4d8;
}

.record-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 900;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
}

.danger-text {
  color: var(--red);
  font-weight: 900;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  border: 0;
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(20, 31, 43, 0.42);
}

.dialog-close-form {
  display: flex;
  justify-content: flex-end;
}

.dialog-close-form button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 24px;
  line-height: 1;
}

.auth-form,
.detail-grid {
  display: grid;
  gap: 14px;
}

.detail-block {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.detail-block img {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .page-tabs {
    top: 67px;
    padding-inline: 10px;
  }

  .page-tabs a {
    min-height: 46px;
    font-size: 14px;
  }

  main {
    padding-inline: 10px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .member-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .member-row > button {
    grid-column: 1 / -1;
  }

  .checkin-shell {
    min-height: calc(100vh - 152px);
  }

  .calendar-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .calendar-person {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .calendar-person small {
    grid-column: 1 / -1;
  }

  .day-strip {
    grid-template-columns: repeat(7, minmax(42px, 1fr));
  }
}

@media (max-width: 520px) {
  .topbar {
    padding: 9px 10px;
    gap: 8px;
  }

  .brand small {
    display: none;
  }

  .brand strong {
    max-width: 128px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .auth-actions,
  .user-actions {
    gap: 6px;
  }

  .user-actions span {
    max-width: 72px;
    font-size: 13px;
  }

  .primary-btn,
  .ghost-btn {
    min-height: 38px;
    padding-inline: 10px;
    font-size: 14px;
  }

  .page-tabs {
    top: 56px;
    gap: 6px;
    padding-block: 7px;
  }

  .page-tabs a {
    gap: 5px;
    min-height: 42px;
    font-size: 13px;
    white-space: nowrap;
  }

  .page-tabs a span {
    display: none;
  }

  main {
    padding-top: 10px;
    padding-bottom: 34px;
  }

  .hero-panel,
  .section,
  .checkin-shell {
    padding: 13px;
  }

  .hero-panel {
    gap: 10px;
  }

  h1 {
    font-size: 30px;
  }

  h2 {
    font-size: 20px;
  }

  .hero-panel p:not(.eyebrow),
  .step-copy {
    line-height: 1.55;
    font-size: 14px;
  }

  .summary-grid {
    gap: 7px;
  }

  .summary-grid div {
    min-height: 58px;
    padding: 9px;
  }

  .summary-grid strong {
    font-size: 20px;
  }

  .summary-grid span {
    font-size: 12px;
  }

  .section-head,
  .step-head {
    align-items: flex-start;
  }

  .section-head {
    margin-bottom: 12px;
  }

  .head-actions {
    width: 100%;
  }

  .head-actions select,
  .head-actions button {
    flex: 1;
  }

  .button-row,
  .time-row {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .member-list {
    grid-template-columns: 1fr;
  }

  .member-row {
    min-height: 0;
    padding: 11px 12px;
  }

  .checkin-shell {
    gap: 12px;
    min-height: calc(100vh - 125px);
    border-inline: 0;
  }

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

  .step-dots {
    gap: 6px;
  }

  .step-dots span {
    height: 6px;
  }

  .checkin-step {
    gap: 12px;
  }

  input,
  select {
    min-height: 40px;
  }

  textarea {
    min-height: 94px;
  }

  .upload-card {
    min-height: 102px;
    gap: 5px;
    padding: 13px;
  }

  .upload-card span {
    font-size: 16px;
  }

  .upload-card small {
    font-size: 12px;
  }

  .upload-card::after {
    padding: 7px 10px;
    font-size: 12px;
  }

  .clear-upload {
    min-height: 32px;
    font-size: 12px;
  }

  .form-message {
    min-height: 20px;
    font-size: 13px;
  }

  .record-row {
    grid-template-columns: 1fr;
  }

  dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}

@media (max-width: 380px) {
  .brand-mark {
    display: none;
  }

  .brand strong {
    max-width: 100px;
    font-size: 14px;
  }

  .topbar {
    padding: 8px;
  }

  .user-actions span {
    max-width: 56px;
  }

  .auth-actions,
  .user-actions {
    gap: 4px;
  }

  .primary-btn,
  .ghost-btn {
    min-height: 34px;
    padding-inline: 8px;
    font-size: 12px;
  }

  .page-tabs {
    top: 50px;
    gap: 4px;
    padding: 5px 7px;
  }

  .page-tabs a {
    min-height: 34px;
    padding-inline: 3px;
    font-size: 12px;
  }

  .page-tabs a span {
    display: none;
  }

  main {
    padding-inline: 7px;
    padding-top: 7px;
  }

  .hero-panel,
  .section,
  .checkin-shell {
    padding: 9px;
  }

  h1 {
    font-size: 24px;
    line-height: 1.12;
  }

  h2 {
    font-size: 18px;
    white-space: nowrap;
  }

  .eyebrow {
    font-size: 12px;
  }

  .step-copy {
    font-size: 13px;
  }

  .section-head {
    gap: 8px;
  }

  .summary-grid {
    gap: 5px;
  }

  .summary-grid div {
    min-height: 50px;
    padding: 7px 5px;
  }

  .summary-grid strong {
    font-size: 18px;
  }

  .summary-grid span {
    font-size: 11px;
    white-space: nowrap;
  }

  .member-row {
    padding: 9px;
    gap: 7px;
  }

  .upload-card {
    min-height: 92px;
  }

  .member-side {
    gap: 3px;
  }

  .status-pill,
  .failure-count {
    font-size: 11px;
  }
}
