:root {
  color-scheme: light;
  --bg: #f4f9ff;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #64748b;
  --line: #d7e7f6;
  --brand: #2269b2;
  --brand-strong: #174f8a;
  --accent: #ec1c24;
  --soft: #e7f5ff;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

a {
  color: inherit;
}

main {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--brand-strong);
  font-weight: 800;
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 32px;
}

.topbar nav {
  display: flex;
  gap: 6px;
}

.topbar nav a {
  padding: 8px 9px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: clamp(26px, 7vw, 38px);
  line-height: 1.08;
}

h2 {
  margin: 24px 0 12px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.page-head,
.student-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 18px;
}

.home-head {
  margin: 8px 0 18px;
}

.home-head h1 {
  margin: 0;
  text-align: center;
  font-size: 34px;
}

.day-nav {
  display: grid;
  grid-template-columns: 56px minmax(150px, auto) 56px;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.day-nav .icon-button {
  width: 56px;
  height: 56px;
}

.day-nav .icon-button svg {
  width: 26px;
  height: 26px;
}

.student-sticky {
  position: sticky;
  top: 52px;
  z-index: 9;
  margin: -1px -16px 14px;
  padding: 1px 16px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.student-head {
  position: relative;
  margin: 0;
  padding: 12px 0 12px 50px;
  background: transparent;
}

.student-edit-action {
  position: absolute;
  top: 12px;
  right: 0;
}

.back-button {
  position: absolute;
  top: 12px;
  left: 0;
}

.student-head h1,
.student-head .contact-lines {
  padding-right: 50px;
}

.cards,
.student-list,
.stack {
  display: grid;
  gap: 12px;
}

.card,
.form-card,
.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.card {
  padding: 14px;
}

.class-card,
.student-card {
  display: grid;
  gap: 12px;
}

.class-card-link {
  color: inherit;
  text-decoration: none;
}

.class-card-link:active {
  transform: translateY(1px);
}

.class-meta-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 7px;
  color: var(--muted);
}

.class-location {
  min-width: 0;
  font-size: 16px;
}

.card-title {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 21px;
  font-weight: 750;
  line-height: 1.15;
  text-decoration: none;
}

.actions,
.pill-row,
.contact-lines,
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-actions {
  justify-content: flex-end;
}

.contact-lines {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 15px;
}

.phone {
  color: var(--brand);
  font-weight: 700;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef2f7;
  color: #334155;
  font-size: 13px;
}

.pill-outline {
  flex: 0 0 auto;
  background: #ffffff;
  border: 1px solid var(--line);
}

button,
.button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 15px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  font: inherit;
  font-weight: 750;
  text-decoration: none;
}

.small-button {
  min-height: 38px;
  padding: 0 12px;
  background: var(--soft);
  color: var(--brand-strong);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-strong);
  text-decoration: none;
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.secondary {
  background: #e2e8f0;
  color: #1f2937;
}

.search {
  margin-bottom: 14px;
}

input,
textarea {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  color: #344054;
  font-weight: 650;
}

.form-card,
.login-panel {
  padding: 16px;
}

.login-panel {
  width: min(420px, 100%);
  margin: 70px auto 0;
}

.error {
  color: var(--danger);
  font-weight: 700;
}

.success {
  color: #167a3f;
  font-weight: 700;
}

.stage-tabs {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 8px 0 12px;
  overflow-x: auto;
  background: transparent;
  border-bottom: 0;
}

.stage-tabs a {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.stage-tabs a.active {
  background: var(--brand);
  color: #ffffff;
}

.skill-board {
  display: grid;
  gap: 18px;
}

.stage-section {
  display: grid;
  gap: 10px;
}

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

.stage-heading h2 {
  margin: 0;
}

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

.stage-action-button {
  width: 54px;
  min-width: 54px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--muted);
  box-shadow: none;
}

.stage-fill-button {
  width: 74px;
  min-width: 74px;
  color: #f4b400;
  font-size: 18px;
  letter-spacing: 0;
}

.stage-clear-button .trash-icon {
  width: 19px;
  height: 19px;
}

.skill-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 320px);
  gap: 14px;
  align-items: center;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.skill-row.saving {
  opacity: 0.65;
}

.skill-code {
  color: var(--muted);
  font-size: 21px;
  font-weight: 850;
  line-height: 1.12;
}

.skill-name {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 560;
  line-height: 1.35;
}

.rating-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.rating-buttons button {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: #a6b1c2;
  box-shadow: none;
}

.rating-buttons button:focus-visible {
  outline: 3px solid rgba(53, 171, 255, 0.35);
  outline-offset: 2px;
}

.rating-buttons button.clear {
  margin-left: auto;
  background: #eef3f8;
  color: var(--muted);
}

.star-button {
  font-size: 38px;
  line-height: 1;
}

.star-button.filled {
  color: #f4b400;
}

.star-button:active,
.rating-buttons button.clear:active {
  transform: translateY(1px);
}

.trash-icon {
  width: 22px;
  height: 22px;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.28);
}

.confirm-modal[hidden] {
  display: none;
}

.confirm-dialog {
  width: min(360px, 100%);
  padding: 18px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
}

.confirm-dialog h3 {
  margin: 0 0 8px;
  font-size: 22px;
}

.confirm-dialog p {
  margin-bottom: 16px;
  color: var(--muted);
}

.confirm-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.confirm-actions button {
  flex: 1 1 0;
  max-width: 150px;
}

.admin-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.action-card {
  display: grid;
  gap: 3px;
  color: inherit;
  text-decoration: none;
}

.action-card span {
  color: var(--muted);
}

@media (max-width: 560px) {
  main {
    padding: 12px;
  }

  .topbar {
    padding: 10px 12px;
  }

  .topbar nav a {
    padding: 8px 6px;
  }

  .page-head,
  .student-head {
    align-items: flex-start;
  }

  .student-sticky {
    top: 49px;
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
  }

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

  .rating-buttons {
    justify-content: space-between;
    gap: 8px;
  }
}
