:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #242424;
  --muted: #68645e;
  --line: #ded8cd;
  --accent: #1f6f68;
  --accent-strong: #18554f;
  --danger: #a53737;
  --focus: #dca548;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

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

.brand {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.topnav {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 8px;
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.page {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

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

h1 {
  margin-bottom: 6px;
  font-size: clamp(1.7rem, 2.4vw, 2.4rem);
  line-height: 1.1;
}

h2 {
  margin-bottom: 14px;
  font-size: 1.15rem;
}

h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

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

button,
.button,
.small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.secondary,
.ghost {
  background: transparent;
  color: var(--accent-strong);
}

.ghost {
  border-color: transparent;
}

.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.9rem;
}

.danger {
  border-color: var(--danger);
  background: transparent;
  color: var(--danger);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  padding: 12px;
  resize: vertical;
}

input:focus,
textarea:focus,
button:focus,
.button:focus {
  outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent);
  outline-offset: 2px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

fieldset {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

legend {
  padding: 0 8px;
  color: var(--muted);
  font-weight: 800;
}

.auth-panel,
.narrow {
  width: min(680px, 100%);
  margin: 60px auto 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stack {
  display: grid;
  gap: 18px;
}

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

.toolbar.compact {
  align-items: center;
  margin-bottom: 4px;
}

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

.grid {
  display: grid;
  gap: 24px;
}

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

.compact-fields {
  gap: 16px;
}

.list {
  display: grid;
  gap: 12px;
}

.item,
.task-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.item {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.link-item {
  align-items: start;
}

.link-item input {
  margin-top: 8px;
  font-size: 0.9rem;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #e3b2b2;
  border-radius: 8px;
  background: #fff1f1;
  color: var(--danger);
  font-weight: 700;
}

.notice,
.notice-panel {
  padding: 12px 14px;
  border: 1px solid #b8d8cc;
  border-radius: 8px;
  background: #edf8f4;
  color: var(--accent-strong);
  font-weight: 700;
}

.notice-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
  padding: 18px;
  background: var(--surface);
}

.item-form {
  align-self: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.editor-layout {
  width: min(920px, 100%);
}

.checkbox-list {
  display: grid;
  gap: 10px;
}

.check-row {
  grid-template-columns: auto 1fr;
  align-items: start;
  padding: 10px;
  border-radius: 7px;
  background: #faf9f6;
  color: var(--ink);
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
}

small {
  display: block;
  color: var(--muted);
  font-weight: 500;
}

.student-head {
  margin-bottom: 24px;
}

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

.task-meta {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: start;
}

.task-meta > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #e5f0ec;
  color: var(--accent-strong);
  font-weight: 900;
}

.content {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.content table {
  width: 100%;
  border-collapse: collapse;
}

.content th,
.content td {
  padding: 8px;
  border: 1px solid var(--line);
}

@media (max-width: 760px) {
  .topbar {
    padding: 0 16px;
  }

  .page {
    width: min(100vw - 20px, 1180px);
    padding-top: 20px;
  }

  .toolbar,
  .item {
    align-items: stretch;
    flex-direction: column;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .actions,
  .row-actions,
  .topnav {
    width: 100%;
  }

  .actions > *,
  .row-actions > *,
  .row-actions form,
  .topnav form {
    flex: 1;
  }
}
