:root {
  color-scheme: light;
  font-family: system-ui, "Microsoft YaHei UI", "PingFang SC", sans-serif;
  color: #172644;
  background: #f3f6fb;
  --surface: #fff;
  --muted: #53637c;
  --line: #d0daea;
  --action: #204da9;
  --strong: #183b84;
  --radius: 1rem;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.55; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.2; }
h2 { font-size: 1.25rem; line-height: 1.3; }
h3 { font-size: 1.0625rem; line-height: 1.35; }
label, input, select, button { font: inherit; }

label {
  display: block;
  font-size: .9375rem;
  font-weight: 650;
}

input, select {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: .375rem;
  padding: .625rem .75rem;
  border: 1px solid #aab9d0;
  border-radius: .625rem;
  background: var(--surface);
  color: inherit;
  font-size: 1rem;
  font-weight: 400;
}

input::placeholder { color: #65738a; }
input[readonly] { background: #f5f8fd; }
input[type="file"] { padding: .375rem; }
input::file-selector-button {
  padding: .35rem .625rem;
  margin-right: .625rem;
  border: 0;
  border-radius: .375rem;
  background: #edf2fb;
  color: var(--strong);
  font: inherit;
  cursor: pointer;
}

button {
  min-height: 2.75rem;
  padding: .5rem 1rem;
  border: 1px solid transparent;
  border-radius: .625rem;
  background: var(--action);
  color: #fff;
  font-weight: 650;
  cursor: pointer;
}

button:hover { background: var(--strong); }
button:disabled { cursor: default; opacity: .55; }
button.secondary {
  border-color: #b4c5e3;
  background: var(--surface);
  color: var(--strong);
}
button.secondary:hover { background: #edf3ff; }
button.quiet { background: transparent; color: var(--strong); }
button.quiet:hover { background: #e9eff9; }

:is(input, select, button, summary):focus-visible {
  outline: 3px solid #436fc5;
  outline-offset: 2px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.card-header { margin-bottom: 1.5rem; }
.card-header p { margin-top: .625rem; color: var(--muted); }
.muted { color: var(--muted); }
.compact { font-size: .9375rem; }
.message { margin-top: .75rem; font-size: .9375rem; color: var(--muted); }
.message:empty { display: none; }
.message.error { color: #a02b36; }
.tabular { font-variant-numeric: tabular-nums; }

.employee {
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 5%, #e0eaff 0, #f3f6fb 65%);
}

.employee-page {
  width: min(100%, 39rem);
  margin-inline: auto;
  padding: clamp(2rem, 12vh, 7.5rem) 1rem 2rem;
}

.employee-card {
  padding: clamp(1.25rem, 5.5vw, 2.5rem);
  box-shadow: 0 1rem 3.75rem #1a438912;
}

.take-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .625rem;
  margin-top: .375rem;
}
.take-fields input { margin-top: 0; }

.code-panel {
  margin-top: 1.375rem;
  padding: 1.125rem 1.25rem;
  border: 1px solid #bfd0ed;
  border-radius: .875rem;
  background: #eff5ff;
}

.code-panel :is(h2, h3) { overflow-wrap: anywhere; }
.code-value {
  margin-block: .25rem .375rem;
  color: #16377d;
  font-family: "Cascadia Mono", Consolas, ui-monospace, monospace;
  font-size: clamp(2rem, 10vw, 3rem);
  font-weight: 700;
  letter-spacing: .095em;
  line-height: 1.2;
  user-select: all;
}

.code-controls, .panel-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem .75rem;
}

.code-controls span { color: #334c76; font-size: .9375rem; }
progress {
  display: block;
  width: 100%;
  height: .3125rem;
  margin-top: .75rem;
  accent-color: var(--action);
  overflow: hidden;
  border: 0;
  border-radius: 100px;
  background: #d7e4f9;
}
progress::-webkit-progress-bar { background: #d7e4f9; }
progress::-webkit-progress-value { background: #3563bc; }
progress::-moz-progress-bar { background: #3563bc; }

.admin-page { width: min(100%, 74rem); margin-inline: auto; padding: 2rem 1rem 4rem; }
.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.admin-grid { display: grid; grid-template-columns: minmax(19rem, 2fr) minmax(0, 3fr); gap: 1.25rem; align-items: start; }
.enrollment, .login-card, .account-card { padding: 1.25rem; }
.login-card { width: min(100%, 26rem); margin: 3rem auto 0; }
.form-stack { display: grid; gap: 1rem; }
.form-stack .message { margin: 0; }
.list-header { margin-bottom: .75rem; }
.account-column > .code-panel { margin: 0 0 .75rem; }
.accounts { display: grid; gap: .75rem; }
#account-status:not(:empty) { margin-bottom: .75rem; }
.empty {
  padding: 1.25rem;
  border: 1px dashed #adbed7;
  border-radius: var(--radius);
}
.account-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem 1rem;
}
.account-heading h3, .email { overflow-wrap: anywhere; }
.email { margin-top: .25rem; font-size: .9375rem; }
.binding {
  display: inline-block;
  padding: .15rem .625rem;
  border-radius: 100px;
  background: #f9edcc;
  color: #634502;
  font-size: .875rem;
  font-weight: 650;
}
.binding.confirmed { background: #e0f2eb; color: #1e634c; }
.account-card .compact { margin-top: .75rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .875rem; }
.grant-tools { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.grant-tools summary { width: fit-content; cursor: pointer; color: var(--strong); font-weight: 650; }
.grant-form, .issued {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .625rem;
  margin-top: .875rem;
}
.grant-form > label, .issued label { flex: 1 1 12rem; min-width: 0; }
.duration-field { flex: 1 1 18rem; min-width: 0; }
.duration-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: .625rem;
}
.duration-presets { display: flex; flex-wrap: wrap; gap: .375rem; margin-top: .5rem; }
.duration-presets button { min-height: 2rem; padding: .25rem .5rem; font-size: .875rem; }
.grants { list-style: none; padding: 0; margin: .75rem 0 0; }
.grants:empty { display: none; }
.grants li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .25rem .625rem;
  padding: .375rem 0;
  border-top: 1px solid #e6edf7;
  min-height: 2.75rem;
}
.grant-time { margin-left: .625rem; font-size: .875rem; }

@media (max-width: 47rem) {
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 30rem) {
  .take-fields { grid-template-columns: minmax(0, 1fr); }
  .admin-page { padding-top: 1rem; }
  .login-card { margin-top: 1rem; }
}
