:root {
  color-scheme: light;
  --ink: #18201f;
  --muted: #68706d;
  --line: #dfe4df;
  --paper: #fbfcf8;
  --panel: #ffffff;
  --accent: #206a5d;
  --accent-strong: #164b42;
  --student: #315f9f;
  --student-strong: #1f3b6e;
  --danger: #a73737;
  --shadow: 0 18px 50px rgba(31, 45, 39, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(32, 106, 93, 0.12), transparent 44%),
    linear-gradient(220deg, rgba(240, 175, 64, 0.13), transparent 36%),
    var(--paper);
}

body.student {
  background:
    linear-gradient(120deg, rgba(49, 95, 159, 0.12), transparent 44%),
    linear-gradient(220deg, rgba(65, 133, 106, 0.12), transparent 36%),
    var(--paper);
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

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

.hero {
  position: relative;
  padding: 34px 0 30px;
}

.hero.compact {
  padding-bottom: 22px;
}

.hero h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero p {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
}

.title-line {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.title-line h1 {
  flex: 0 1 auto;
}

.title-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 6px;
}

.title-actions form {
  margin: 0;
}

.student-title-edit {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  max-width: 1080px;
}

.student-title-edit label {
  margin-top: 0;
}

.split {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(340px, 1.18fr);
  gap: 20px;
  align-items: start;
}

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

.panel,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

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

.student-sections {
  display: grid;
  gap: 20px;
}

.muted-panel {
  box-shadow: none;
  background: rgba(255, 255, 255, 0.62);
}

.muted-panel .homework-list li {
  background: rgba(255, 255, 255, 0.74);
}

.muted-panel time,
.muted-panel .homework-list p {
  color: var(--muted);
}

.panel h2 {
  margin: 0 0 20px;
  font-size: 1.2rem;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 0;
}

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

.panel-heading span {
  display: inline-grid;
  min-width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.student .panel-heading span {
  background: var(--student);
}

label {
  display: block;
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cfd8d2;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(32, 106, 93, 0.14);
}

.student input:focus,
.student select:focus {
  border-color: var(--student);
  box-shadow: 0 0 0 4px rgba(49, 95, 159, 0.14);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.8fr;
  gap: 10px;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

.student button {
  background: var(--student);
}

.student button:hover {
  background: var(--student-strong);
}

.ghost {
  min-height: 36px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  font-size: 0.88rem;
}

.ghost:hover {
  color: #fff;
  background: var(--ink);
}

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

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

.student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  color: inherit;
  text-decoration: none;
  border-top: 1px solid var(--line);
}

.student-row > div {
  min-width: 0;
}

.student-row:first-of-type {
  border-top: 0;
}

.student-row strong {
  display: block;
  font-size: 1rem;
}

small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.copy-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.copy-line span,
.copy-line strong {
  overflow-wrap: anywhere;
}

.copy-button {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 0.82rem;
  line-height: 1;
}

.copy-button:disabled {
  cursor: default;
  opacity: 0.82;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  place-items: center;
  padding: 0;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--line);
}

.icon-button:hover,
.icon-button[aria-expanded="true"] {
  color: #fff;
  background: var(--accent-strong);
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.icon-button:disabled {
  cursor: default;
  opacity: 0.65;
}

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

.danger-button:hover {
  background: #7f2424;
}

.filter-panel {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-height: 180px;
  margin: -4px 0 8px;
  overflow: hidden;
  opacity: 1;
  transform: translateY(0);
  transition: max-height 180ms ease, opacity 180ms ease, margin 180ms ease, transform 180ms ease;
}

.filter-panel[data-collapsed="true"] {
  max-height: 0;
  margin-bottom: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
}

.filter-chip {
  min-height: 34px;
  border: 1px solid var(--line);
  padding: 7px 10px;
  color: var(--accent);
  background: #fff;
  font-size: 0.86rem;
}

.filter-chip:hover,
.filter-chip[aria-pressed="true"] {
  color: #fff;
  background: var(--accent);
  transition: color 180ms ease, background 180ms ease;
}

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

.notice {
  margin-bottom: 20px;
  padding: 14px 18px;
  border-color: rgba(32, 106, 93, 0.35);
  background: rgba(238, 250, 246, 0.96);
}

.notice a {
  font-weight: 800;
}

.homework-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.homework-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.editable-list li {
  display: grid;
  align-items: stretch;
}

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

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

.homework-edit {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 0.44fr) auto;
  gap: 10px;
  align-items: end;
  width: 100%;
}

.field {
  min-width: 0;
}

.field label {
  margin-top: 0;
}

.homework-edit .form-actions {
  grid-column: auto;
  grid-row: auto;
}

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

time {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
}

.student time {
  color: var(--student);
}

.homework-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.homework-meta span {
  color: var(--muted);
  font-size: 0.94rem;
}

.homework-list p {
  margin: 6px 0 0;
}

.empty {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 760px) {
  .page {
    width: min(100% - 24px, 1080px);
    padding-top: 18px;
  }

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

  .hero h1 {
    font-size: clamp(2.2rem, 16vw, 4rem);
  }

  .student-row,
  .homework-view,
  .row-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .title-line {
    align-items: center;
  }

  .title-actions {
    padding-top: 0;
  }

  .student-title-edit {
    grid-template-columns: 1fr;
  }

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

  .homework-edit {
    grid-template-columns: 1fr;
  }

  .homework-edit .form-actions {
    grid-column: 1;
  }

  .homework-edit .form-actions {
    grid-row: auto;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .form-actions button {
    width: 100%;
  }

  .row-actions,
  .row-actions form,
  .row-actions button,
  .homework-list button {
    width: 100%;
  }

  .icon-button {
    width: 42px;
  }
}
