:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #12665f;
  --accent-strong: #0d4f49;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px min(5vw, 56px);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 22px;
  font-weight: 700;
}

nav {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
}

.language-toggle {
  min-width: 48px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-weight: 650;
}

.language-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.primary-link,
.button,
button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  font: inherit;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

button {
  min-width: 84px;
}

.primary-link:hover,
.button:hover,
button:hover {
  background: var(--accent-strong);
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 36px auto;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 24px;
}

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

h1 {
  margin-bottom: 8px;
  font-size: 32px;
}

h2 {
  font-size: 20px;
}

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

.search {
  display: flex;
  gap: 10px;
  width: min(520px, 100%);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
}

textarea {
  resize: vertical;
}

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

.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.student-card,
.empty-state,
.form-shell,
.profile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.student-card {
  display: flex;
  gap: 14px;
  padding: 16px;
}

.avatar {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 50%;
  background: #d8eee9;
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  font-weight: 750;
  font-size: 22px;
}

.avatar.large {
  width: 96px;
  height: 96px;
  font-size: 36px;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.student-name {
  display: block;
  margin-bottom: 4px;
  font-size: 18px;
  font-weight: 700;
}

.card-body p {
  margin-bottom: 6px;
}

.empty-state,
.form-shell,
.profile {
  padding: 28px;
}

.student-form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 650;
}

.field-title {
  margin-bottom: 8px;
  font-weight: 650;
}

.avatar-field {
  display: grid;
  gap: 12px;
}

.avatar-upload-row {
  display: flex;
}

.avatar-dropzone {
  width: 100%;
  min-height: 112px;
  justify-content: flex-start;
  gap: 16px;
  border: 1px dashed var(--line);
  background: #f9fbfb;
  color: var(--text);
  text-align: left;
}

.avatar-dropzone:hover,
.avatar-dropzone.is-dragging {
  border-color: var(--accent);
  background: #edf7f5;
  color: var(--text);
}

.avatar-dropzone:disabled {
  cursor: progress;
  opacity: 0.72;
}

.avatar-preview {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 50%;
  background: #d8eee9;
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 750;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-status {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--muted);
}

.upload-status.error {
  color: var(--danger);
}

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

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.actions a:not(.button) {
  color: var(--muted);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}

.profile-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 28px;
}

.profile-fields div {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

dt {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 4px;
}

dd {
  margin: 0;
}

.bio {
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.danger {
  background: var(--danger);
}

.danger:hover {
  background: #8f1d14;
}

@media (max-width: 720px) {
  .topbar,
  .toolbar,
  .search,
  .profile-header {
    align-items: stretch;
    flex-direction: column;
  }

  .form-row,
  .profile-fields {
    grid-template-columns: 1fr;
  }
}
