:root {
  --bg: #a8a8a8;
  --desktop: #888888;
  --paper: #ffffff;
  --ink: #000000;
  --chrome: #dddddd;
  --muted: #444444;
  --danger: #000000;
  --ok: #000000;
  --font-sys: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", "Noto Sans", Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", "Noto Sans", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--desktop);
  background-image: repeating-conic-gradient(var(--bg) 0 25%, #9a9a9a 0 50%);
  background-size: 4px 4px;
  color: var(--ink);
  font: 12px var(--font-body);
  image-rendering: pixelated;
  text-transform: lowercase;
}

a {
  color: var(--ink);
  text-decoration: underline;
}

.primary-link {
  display: inline-block;
}

button,
input,
select {
  font: 12px var(--font-body);
}

code,
pre {
  font-family: "Courier New", Courier, monospace;
}

code,
pre,
input {
  text-transform: none;
}

.shell {
  min-height: 100vh;
  display: block;
}

.topbar {
  width: 100%;
  position: relative;
  min-height: 22px;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
  padding: 1px 154px 1px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-sys);
}

.topbar-line {
  display: flex;
  min-height: 20px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.eye-icon {
  width: 18px;
  height: 10px;
  display: inline-block;
  position: relative;
  margin: 0 4px 0 0;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
}

.eye-icon::before {
  content: "";
  width: 6px;
  height: 6px;
  position: absolute;
  left: 5px;
  top: 1px;
  border-radius: 50%;
  background: var(--ink);
}

.eye-icon.closed {
  height: 2px;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
}

.eye-icon.closed::before {
  display: none;
}

.account-form {
  margin: 0;
  padding: 0;
  display: inline-flex;
}

.topbar-actions {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-item {
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  border: 0;
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: none;
  font-family: var(--font-sys);
  text-decoration: none;
  white-space: nowrap;
}

.topbar-item:hover,
.topbar-item.active {
  background: var(--ink);
  color: var(--paper);
}

.account-name {
  max-width: min(260px, 34vw);
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-name:hover {
  background: var(--paper);
  color: var(--ink);
}

.account-name.active,
.account-name.active:hover {
  background: var(--ink);
  color: var(--paper);
}

.topbar-button {
  min-height: 18px;
  border: 1px solid var(--ink);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  padding: 1px 12px 2px;
  box-shadow: 1px 1px 0 var(--ink);
  font-family: var(--font-sys);
  line-height: 14px;
  cursor: pointer;
}

.topbar-button:active {
  background: var(--ink);
  color: var(--paper);
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  white-space: nowrap;
}

.inline-check input {
  appearance: none;
  width: 11px;
  height: 11px;
  border: 1px solid var(--ink);
  background: var(--paper);
  margin: 0;
}

.inline-check input:checked::after {
  content: "x";
  display: block;
  line-height: 9px;
  text-align: center;
  font-size: 10px;
}

.content {
  width: min(980px, calc(100vw - 40px));
  margin: 22px auto;
  min-width: 0;
}

.auth-content {
  width: 100%;
  min-height: calc(100vh - 24px);
  display: grid;
  place-items: start center;
  padding: 64px 20px 20px;
}

.auth-panel,
.section,
.page-head {
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}

.auth-panel {
  width: 360px;
}

.auth-head,
h2 {
  min-height: 20px;
  background: repeating-linear-gradient(to bottom, var(--ink) 0 1px, var(--paper) 1px 2px);
  border-bottom: 1px solid var(--ink);
  padding: 3px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sys);
}

.auth-head h1,
h2 {
  font-size: 12px;
  font-weight: normal;
}

.auth-head h1,
h2 > span {
  background: var(--paper);
}

.auth-head h1 {
  padding: 0 10px;
}

.auth-panel .form-stack,
.auth-panel .notice,
.auth-panel .muted,
.auth-panel .primary-link {
  margin: 12px;
}

h1 {
  margin: 0;
  font-family: var(--font-sys);
  font-size: 22px;
  font-weight: normal;
}

h2 {
  margin: -12px -12px 12px;
  padding-left: 10px;
  padding-right: 10px;
  text-align: center;
  text-shadow:
    -10px 0 0 var(--paper),
    -8px 0 0 var(--paper),
    -6px 0 0 var(--paper),
    -4px 0 0 var(--paper),
    -2px 0 0 var(--paper),
    2px 0 0 var(--paper),
    4px 0 0 var(--paper),
    6px 0 0 var(--paper),
    8px 0 0 var(--paper),
    10px 0 0 var(--paper);
}

p {
  line-height: 1.35;
}

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

.muted {
  color: var(--muted);
  margin: 5px 0 0;
}

.tight {
  margin-bottom: 12px;
}

.section {
  padding: 12px;
  margin-bottom: 16px;
}

.account-settings {
  width: min(440px, 100%);
  margin: 0 auto 16px;
}

.form-stack,
.form-grid,
.lookup-form {
  display: grid;
  gap: 10px;
}

.form-grid {
  grid-template-columns: minmax(0, 1fr) 150px;
  align-items: end;
}

.wide {
  grid-column: 1 / -1;
}

label span {
  display: block;
  margin-bottom: 3px;
  font-family: var(--font-sys);
}

input,
select {
  width: 100%;
  height: 24px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  padding: 2px 4px;
  box-shadow: inset 1px 1px 0 #888888;
}

input:focus,
select:focus {
  outline: 1px dotted var(--ink);
  outline-offset: 2px;
}

.primary-button,
.ghost-button,
.danger-button,
.small-danger,
.small-enable {
  min-height: 24px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 3px 14px;
  box-shadow: 1px 1px 0 var(--ink);
  cursor: pointer;
  font-family: var(--font-sys);
}

.primary-button {
  border: 3px double var(--ink);
  font-weight: bold;
}

.primary-button:active,
.ghost-button:active,
.danger-button:active,
.small-danger:active,
.small-enable {
  background: var(--ink);
  color: var(--paper);
}

.danger-button,
.small-danger {
  color: var(--danger);
}

.small-danger,
.small-enable {
  min-height: 20px;
  padding: 1px 8px;
}

.small-enable:active {
  background: var(--paper);
  color: var(--ink);
}

.admin-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-row-actions form {
  margin: 0;
}

.link-button {
  display: inline-block;
  min-height: 24px;
  line-height: 16px;
  text-decoration: none;
}

.verification-cta {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.notice {
  padding: 7px 8px;
  margin-bottom: 12px;
  border: 1px solid var(--ink);
  background: var(--paper);
  box-shadow: 1px 1px 0 var(--ink);
}

.notice.error {
  border: 3px double var(--ink);
  color: var(--ink);
}

.notice.success {
  color: var(--ink);
  word-break: break-all;
}

.status {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--ink);
  background: var(--paper);
  box-shadow: 1px 1px 0 var(--ink);
  white-space: nowrap;
  font-family: var(--font-sys);
}

.status.good,
.status.warn {
  color: var(--ink);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tab {
  min-height: 24px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  padding: 3px 14px;
  box-shadow: 1px 1px 0 var(--ink);
  cursor: pointer;
  font-family: var(--font-sys);
}

.tab.active {
  border: 3px double var(--ink);
  font-weight: bold;
}

.lookup-grid {
  display: grid;
  gap: 12px;
}

.lookup-grid.query-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lookup-grid.single {
  grid-template-columns: minmax(0, 1fr);
}

.lookup-grid.student-query {
  grid-template-columns: minmax(0, 1fr);
}

.lookup-form {
  padding: 0;
}

.lookup-block-title {
  min-height: auto;
  margin: 0 0 10px;
  padding: 0;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  text-align: left;
  text-shadow: none;
  font-weight: bold;
}

.student-query-form {
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) auto;
  align-items: end;
  width: 100%;
}

.pinpoint-form {
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) auto;
  align-items: end;
  width: 100%;
}

.course-query-form {
  grid-template-columns: minmax(82px, 1fr) minmax(0, 2fr) auto;
  align-items: end;
  width: 100%;
}

.ranking-query-form {
  grid-template-columns: minmax(0, 1fr) 110px auto;
  align-items: end;
  width: min(650px, 100%);
}

.result-head,
.action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.result-head h2 {
  min-height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  display: block;
  text-align: left;
  text-shadow: none;
  font-size: 14px;
}

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

.course-class-groups {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.course-class-group h3 {
  margin: 0;
  padding: 4px 6px;
  border: 1px solid var(--ink);
  border-bottom: 0;
  background: var(--chrome);
  font-size: 12px;
  font-weight: normal;
}

.course-results-table {
  min-width: 420px;
}

.course-results-table th:first-child,
.course-results-table td:first-child {
  width: 120px;
}

.result-block {
  max-height: 560px;
  overflow: auto;
  border: 1px solid var(--ink);
  padding: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  box-shadow: inset 1px 1px 0 #888888;
}

.rows {
  display: block;
  padding: 0;
}

.row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 8px;
  border-bottom: 1px solid var(--ink);
}

.row:last-child {
  border-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--ink);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
}

.admin-users-table,
.admin-invites-table {
  table-layout: fixed;
}

.admin-users-table {
  min-width: 680px;
}

.admin-users-table .users-account {
  width: 28%;
}

.admin-users-table .users-role {
  width: 14%;
}

.admin-users-table .users-status {
  width: 16%;
}

.admin-users-table .users-hust {
  width: 18%;
}

.admin-users-table .users-actions {
  width: 24%;
}

.admin-invites-table {
  min-width: 720px;
}

.admin-invites-table .invites-account {
  width: 24%;
}

.admin-invites-table .invites-expires,
.admin-invites-table .invites-used {
  width: 33%;
}

.admin-invites-table .invites-actions {
  width: 10%;
}

.student-results-table {
  min-width: 940px;
  table-layout: fixed;
}

.student-results-table .student-id {
  width: 12%;
}

.student-results-table .student-name {
  width: 19%;
}

.student-results-table .student-year {
  width: 7%;
}

.student-results-table .student-school {
  width: 25%;
}

.student-results-table .student-class {
  width: 37%;
}

.class-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
  margin-bottom: 10px;
}

.class-result + .class-result {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--ink);
}

.class-summary-item {
  min-width: 0;
  padding: 4px 6px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.class-summary-item dt {
  font-family: var(--font-sys);
  color: var(--muted);
}

.class-summary-item dd {
  margin: 1px 0 0;
  overflow-wrap: anywhere;
}

.class-results-table {
  min-width: 760px;
  table-layout: fixed;
}

.ranking-results-table {
  min-width: 560px;
  table-layout: fixed;
}

.ranking-results-table th,
.ranking-results-table td {
  padding: 3px 5px;
}

.ranking-results-table th:nth-child(1) {
  width: 58px;
}

.ranking-results-table th:nth-child(2) {
  width: 120px;
}

.ranking-results-table th:nth-child(4),
.ranking-results-table th:nth-child(5) {
  width: 72px;
}

.ranking-results-table td:nth-child(1),
.ranking-results-table td:nth-child(4),
.ranking-results-table td:nth-child(5) {
  text-align: right;
}

.class-results-table th,
.class-results-table td {
  padding: 3px 5px;
}

.class-results-table th:nth-child(1) {
  width: 110px;
}

.class-results-table th:nth-child(2) {
  width: auto;
}

.class-results-table th:nth-child(n + 3) {
  width: 78px;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: inherit;
}

.sort-button::after {
  content: "-";
  color: var(--muted);
}

.sort-button[data-sort-direction="asc"]::after {
  content: "^";
  color: var(--ink);
}

.sort-button[data-sort-direction="desc"]::after {
  content: "v";
  color: var(--ink);
}

.class-results-table td:nth-child(n + 3) {
  text-align: right;
}

.class-student-name {
  display: flex;
  gap: 8px;
  align-items: baseline;
  width: 100%;
}

.class-student-name > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.class-absent-count {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-sys);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.student-detail-row > td {
  padding: 0;
}

.student-detail-row summary {
  padding: 4px 6px;
  cursor: pointer;
  font-family: var(--font-sys);
}

.student-fields {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  border-top: 1px solid var(--ink);
}

.student-avatar-cell {
  padding: 6px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.student-field-grid {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.student-avatar-cell + .student-field-grid {
  grid-column: auto;
}

.student-field {
  min-width: 0;
  min-height: 38px;
  padding: 4px 6px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.student-field-admission {
  grid-column: span 3;
}

.student-field-profile,
.student-field-address,
.student-field-contact {
  grid-column: span 2;
}

.student-field dt {
  font-family: var(--font-sys);
  color: var(--muted);
  line-height: 1.15;
}

.student-field-address dt {
  display: none;
}

.student-field dd {
  margin: 1px 0 0;
  line-height: 1.2;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  text-transform: none;
}

.student-field-address dd {
  margin-top: 0;
}

.student-avatar {
  display: block;
  width: 92px;
  height: 115px;
  object-fit: cover;
  border: 1px solid var(--ink);
  background: var(--chrome);
}

th,
td {
  border: 1px solid var(--ink);
  padding: 5px 6px;
  line-height: 1.35;
  text-align: left;
  vertical-align: top;
}

th {
  background: repeating-linear-gradient(to bottom, var(--ink) 0 1px, var(--paper) 1px 2px);
  font-family: var(--font-sys);
  font-weight: normal;
}

th::first-line {
  background: var(--paper);
}

@media (max-width: 760px) {
  .topbar {
    overflow-x: auto;
  }

  .topbar-line {
    min-width: max-content;
  }

  .content {
    width: calc(100vw - 18px);
    margin: 10px auto;
  }

  .auth-content {
    padding: 42px 10px 10px;
  }

  .auth-panel {
    width: min(360px, 100%);
  }

  .page-head,
  .lookup-grid,
  .form-grid,
  .ranking-query-form,
  .row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .class-summary,
  .course-summary,
  .student-fields {
    grid-template-columns: 1fr;
  }

  .student-avatar-cell {
    border-right: 0;
  }

  .student-field-grid {
    grid-template-columns: 1fr;
  }

  .student-field-admission,
  .student-field-profile,
  .student-field-address,
  .student-field-contact {
    grid-column: auto;
  }
}
