:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  color: #20242a;
  background: #ffffff;
  font-size: 14px;
  line-height: 1.45;

  --border: #d2d7de;
  --muted: #616974;
  --blue: #22569a;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
}

.container {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
}

main {
  padding: 20px 0 32px;
}

h1 {
  margin: 0 0 16px;
  font-size: 26px;
}

h2 {
  margin: 0 0 12px;
  font-size: 17px;
}

.panel {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ffffff;
}

.login-panel {
  max-width: 420px;
}

.registration-panel {
  max-width: 780px;
}

.reset-panel {
  margin-top: 12px;
}

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

.field label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

input:not([type="checkbox"]) {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #b9c1cb;
  border-radius: 3px;
  color: inherit;
  background: #ffffff;
  font: inherit;
}

button {
  padding: 7px 11px;
  border: 1px solid #b9c1cb;
  border-radius: 3px;
  color: inherit;
  background: #f5f6f8;
  font: inherit;
  cursor: pointer;
}

button:hover:enabled {
  background: #e9edf2;
}

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

button.primary:hover:enabled {
  background: #184477;
}

button:disabled,
fieldset:disabled button {
  cursor: default;
  opacity: 0.6;
}

input:disabled {
  color: var(--muted);
  background: #f6f7f9;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

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

.name-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.password-field {
  display: flex;
  gap: 6px;
}

.password-field input {
  flex: 1;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 12px;
}

.check-row input {
  margin: 0;
}

.subject-list {
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid var(--border);
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2 {
  margin-bottom: 3px;
}

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

.message {
  margin: 10px 0;
}

.message:empty {
  display: none;
}

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

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

th,
td {
  padding: 8px;
  border: 1px solid var(--border);
  text-align: center;
}

th {
  background: #f0f2f5;
}

th:first-child,
tbody th[scope="row"],
td:first-child {
  text-align: left;
}

thead th:first-child {
  width: 24%;
}

td.empty-row {
  padding: 18px 8px;
  color: var(--muted);
  text-align: center;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.legend strong {
  color: #20242a;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 520px) {
  .form-grid,
  .name-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .container {
    width: calc(100% - 24px);
  }

  .panel {
    padding: 12px;
  }
}
.site-brand, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.header-inner { flex-wrap: wrap; }
h3 { margin: 0 0 10px; font-size: 15px; }
p { overflow-wrap: anywhere; }
a { color: var(--blue); }
button { min-height: 38px; }
select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #b9c1cb;
  border-radius: 3px;
  color: inherit;
  background: #fff;
  font: inherit;
}
textarea { resize: vertical; }
label.field { display: block; font-weight: 600; }
label.field :is(input, select) { margin-top: 4px; font-weight: 400; }
.tag { padding: 2px 7px; border: 1px solid var(--border); border-radius: 3px; color: var(--muted); font-size: 12px; }
.subheading { margin: 2px 0 10px; }
.class-summary { margin: 12px 0; padding: 10px; border: 1px solid var(--border); border-radius: 3px; }
.class-summary p { margin: 4px 0 0; }
.space-switch, .section-nav { margin-bottom: 14px; }
.section-nav button[aria-pressed="true"], .space-switch button[aria-pressed="true"], button[data-control="missing"][aria-pressed="true"] {
  border-color: var(--blue);
  color: var(--blue);
  background: #eaf1fb;
}
.subpanel, .queue article {
  min-width: 0;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.split-grid, .history-filters, .slot-row, .inline-form {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.split-grid { grid-template-columns: 1fr 1fr; align-items: start; }
.history-filters { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); margin: 12px 0 6px; }
.history-filters .field, .slot-row .field, .inline-form .field { margin: 0; }
.slot-row { grid-template-columns: 1.2fr 1fr 1fr auto; align-items: end; margin-bottom: 10px; }
.inline-form { grid-template-columns: minmax(0, 360px) auto; justify-content: start; align-items: end; }
.compact-field { max-width: 370px; }
.subject-cards { margin: 8px 0 0; padding: 0; list-style: none; }
.subject-cards li { padding: 9px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.subject-cards small { display: block; }
.subject-cards button { margin-top: 5px; }
.subject-cards:empty, .period-summary:empty { display: none; }
.table-scroll { margin: 10px 0; }
.history-table { min-width: 0; }
.history-table th:not(:first-child), .history-table td { min-width: 68px; white-space: nowrap; }
.history-table tr > :first-child { position: sticky; left: 0; z-index: 1; min-width: 112px; max-width: 168px; width: auto; background: #f0f2f5; overflow-wrap: anywhere; }
.history-table tr > .empty-row { position: static; max-width: none; background: white; }
.editor-table { min-width: 465px; }
.editor-table td { text-align: left; }
.editor-table textarea { min-width: 140px; }
.masterlist-table { min-width: 655px; }
.masterlist-table td { text-align: left; overflow-wrap: anywhere; }
.masterlist-table .empty-row { text-align: center; }
.period-summary { margin: 10px 0 0; }
.legend > span { display: inline-flex; align-items: center; gap: 5px; }
.badge {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 30px;
  min-height: 24px;
  padding: 2px 5px;
  border: 1px solid currentColor;
  border-radius: 3px;
  background: var(--badge-bg, #f5f6f8);
  color: var(--badge-fg, #535c68);
  font-weight: 700;
}
button.badge { min-width: 38px; min-height: 38px; }
button.badge:hover:enabled { background: var(--badge-bg, #f5f6f8); text-decoration: underline; }
.present { --badge-fg: #146437; --badge-bg: #e7f5eb; }
.absent { --badge-fg: #9e2431; --badge-bg: #fdebee; }
.late { --badge-fg: #904405; --badge-bg: #fff0df; }
.excused { --badge-fg: #715400; --badge-bg: #fff4c8; }
.asynchronous { --badge-fg: #603389; --badge-bg: #f3eafb; }
.proof-preview { display: block; width: auto; max-width: 100%; max-height: 285px; margin: 8px 0 12px; object-fit: contain; }
.demo-actions { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: 85dvh;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: inherit;
  overflow: auto;
}
dialog::backdrop { background: #1e27346b; }
dialog dl { display: grid; grid-template-columns: minmax(85px, auto) minmax(0, 1fr); gap: 7px 12px; }
dialog dt { font-weight: 600; }
dialog dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .split-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .inline-form { grid-template-columns: minmax(0, 1fr); }
  .slot-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-heading { flex-wrap: wrap; align-items: center; gap: 7px; }
  :is(input, select, textarea):not([type="checkbox"]) { font-size: 16px; }
  button { min-height: 42px; }
  .history-table tr > :first-child { min-width: 97px; max-width: 122px; }
}
.subject-number { display: block; font-weight: 400; }
