:root {
  color-scheme: light;
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #17212b;
  background: #f2f4f6;
  --topbar-height: 44px;
  --footer-height: 44px;
}

* { box-sizing: border-box; }
body { min-height: 100vh; display: flex; flex-direction: column; margin: 0; }
a { color: #075a83; }
a:hover { color: #003e5e; }

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  flex-wrap: nowrap;
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  padding: .2rem 1rem;
  color: white;
  background: #163d53;
}
.topbar a { color: white; text-decoration: none; }
.brand { flex: 0 0 auto; font-size: .95rem; font-weight: 700; line-height: 1; white-space: nowrap; }
.topbar nav { display: flex; flex: 1; align-items: center; gap: 1rem; flex-wrap: wrap; line-height: 1; }
.topbar .refresh-button { flex: 0 0 1.4rem; width: 1.4rem; height: 1.4rem; margin-left: auto; padding: 0; border-color: transparent; background: transparent; color: white; font-size: 1.3rem; line-height: 1; }
.topbar .refresh-button:hover { border-color: #426477; background: #24556f; color: white; }

.wrap { width: 100%; max-width: 1600px; flex: 1; margin: 0 auto; padding: calc(var(--topbar-height) + 1rem) 1rem calc(var(--footer-height) + 1rem); }
.page-footer { position: fixed; inset: auto 0 0; z-index: 10; display: flex; justify-content: center; align-items: center; gap: .8rem; min-height: var(--footer-height); padding: .65rem 1rem; color: white; background: #163d53; }
.page-footer form { margin: 0; }
.logout-link { padding: 0; border: 0; background: none; color: white; text-decoration: underline; }
.logout-link:hover { background: none; color: #d7e7ef; }
h1 { margin: 0 0 .8rem; font-size: 1.5rem; }
h2 { margin: 0 0 .75rem; font-size: 1.08rem; }
p { margin: .35rem 0 .8rem; }
.muted { color: #596773; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: .2rem 0 1rem; }
.page-heading h1 { margin-bottom: .2rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.section-toolbar { margin: 0 0 .5rem; }
.panel { background: white; border: 1px solid #cbd3d9; border-radius: 4px; padding: 1rem; margin: 0 0 1rem; }
.subheading { margin-top: 1rem; }
.section-grid { display: flex; flex-wrap: wrap; gap: .6rem; }
.section-card { display: block; padding: .75rem 1rem; border: 1px solid #9eabb4; border-radius: 3px; text-decoration: none; font-weight: 600; }
.notice { padding: .75rem; border: 1px solid #d5b66d; background: #fff8e5; margin-bottom: 1rem; }

button, .button {
  display: inline-block;
  padding: .4rem .65rem;
  border: 1px solid #0e587e;
  border-radius: 3px;
  background: #0e587e;
  color: white;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .button:hover { background: #084363; color: white; }
button.danger { border-color: #9c3030; background: #a43838; }
button.danger:hover { background: #7c2525; }
input, select {
  max-width: 100%;
  border: 1px solid #9aa8b2;
  border-radius: 3px;
  padding: .38rem .45rem;
  color: inherit;
  background: white;
  font: inherit;
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid #e2a900;
  outline-offset: 1px;
}
label { display: flex; flex-direction: column; gap: .2rem; }
.inline-form { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }
.inline-form label { min-width: 180px; }
.wrap-form { align-items: end; }
.grow { flex: 1; }
.list { display: flex; flex-direction: column; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .55rem 0; border-top: 1px solid #e0e5e8; }
.list-row:first-child { border-top: 0; }
.skill-heading-row { background: #e9eef1; }
.skill-heading-row input:not([type=hidden]) { font-weight: 700; }
.list-actions { display: flex; gap: .35rem; }
.list-actions form { margin: 0; }
.list-actions button:disabled { cursor: default; opacity: .4; }
.monitor-row { align-items: end; }

.table-scroll { width: 100%; max-height: calc(100vh - var(--topbar-height) - var(--footer-height) - 6rem); max-height: calc(100dvh - var(--topbar-height) - var(--footer-height) - 6rem); overflow: auto; overscroll-behavior: none; border: 1px solid #cbd3d9; background: white; }
.evaluation-table { max-height: calc(100vh - var(--topbar-height) - var(--footer-height) - 4rem); max-height: calc(100dvh - var(--topbar-height) - var(--footer-height) - 4rem); }
html.evaluation-page, body.evaluation-page { height: 100%; overflow: hidden; }
body.evaluation-page { height: 100vh; height: 100dvh; min-height: 0; }
main.evaluation-page { max-width: none; min-height: 0; overflow: hidden; display: flex; flex-direction: column; padding: calc(var(--topbar-height) + .5rem) .5rem calc(var(--footer-height) + .5rem); }
main.evaluation-page .evaluation-table { flex: 1 1 0; min-height: 0; max-height: none; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .45rem; border-right: 1px solid #d9dfe3; border-bottom: 1px solid #d9dfe3; text-align: left; vertical-align: top; }
thead th { position: sticky; top: 0; z-index: 3; background: #e9eef1; }
.matrix { min-width: max-content; font: inherit; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.matrix td { min-width: 112px; max-width: 150px; padding: .25rem; vertical-align: middle; }
.matrix .student-heading { min-width: 112px; max-width: 150px; text-align: center; }
.matrix .skill-column { position: sticky; left: 0; z-index: 2; min-width: 0; max-width: 20ch; padding-right: .1rem; overflow-wrap: anywhere; background: #f4f6f7; }
.matrix thead .skill-column { z-index: 4; background: #e9eef1; }
.matrix .section-heading-row th { position: static; max-width: none; padding: 0; overflow-wrap: normal; white-space: nowrap; background: #dce5ea; font-size: 1rem; font-weight: 700; }
.section-heading-label { position: sticky; left: 0; z-index: 2; display: block; width: max-content; padding: .45rem; background: #dce5ea; }
.assessment-cell { display: flex; align-items: center; justify-content: center; gap: .2rem; }
.assessment-form { display: contents; }
.step-button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border-color: #b5c8d1; border-radius: 50%; background: #e7eff3; color: #345565; font-size: 1.1rem; line-height: 1; }
.step-button:hover { border-color: #9eb6c2; background: #d8e6ec; color: #294857; }
.step-button:disabled { cursor: default; opacity: .4; }
.assessment-status.status-not_acquired { background: #f1f3f4; }
.assessment-status.status-in_progress { background: #ffe9ad; }
.assessment-status.status-acquired { background: #d3eadb; }
.assessment-status.status-mastered { background: #bfe0ca; }
.status-pill { display: inline-grid; place-items: center; flex: 0 0 40px; width: 40px; height: 28px; border: 0; border-radius: 999px; background: transparent; font-weight: 700; }
.skill-select { width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; font: inherit; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.skill-select:hover { background: transparent; color: inherit; }
.matrix.has-selected-rows tbody tr:not(.skill-selected):not(.section-heading-row) td { filter: grayscale(1) opacity(.4) blur(6px); pointer-events: none; }
.pwa-panel { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem; }
.pwa-panel p { margin: 0; }
.pwa-panel button[hidden] { display: none; }
.student-progress { display: block; color: #596773; font-size: .8rem; font-weight: 400; }
.save-status { min-height: 1.4em; margin: .4rem 0; color: #9c3030; }
.log-table td:first-child { white-space: nowrap; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-panel { width: min(100%, 390px); }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.stack button { align-self: flex-start; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 700px) {
  :root { --topbar-height: 66px; --footer-height: 48px; }
  .topbar { padding: .35rem .65rem; }
  .topbar nav { width: 100%; gap: .7rem; }
  .topbar .refresh-button { flex-basis: 1.4rem; width: 1.4rem; height: 1.4rem; font-size: 1.3rem; }
  .wrap { padding: calc(var(--topbar-height) + .65rem) .65rem calc(var(--footer-height) + .65rem); }
  .page-footer { flex-wrap: wrap; padding: .65rem; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .list-row { align-items: stretch; flex-direction: column; }
  .list-row > form { width: 100%; }
  .list-row .inline-form input:not([type=hidden]) { flex: 1; min-width: 130px; }
  .list-row .list-actions { width: 100%; }
  .list-row .list-actions form { width: auto; }
  .monitor-row { align-items: stretch; }
  .wrap-form label { flex: 1 1 100%; }
  .toolbar { width: auto; }
  .section-toolbar { width: 100%; }
  .section-toolbar select { max-width: 60vw; }
}

@media (orientation: landscape) {
  .wrap { padding-top: var(--topbar-height); }
}
