:root {
  --bg: #f2efe7;
  --card: #fffdf8;
  --ink: #1f2933;
  --muted: #52606d;
  --primary: #114b5f;
  --primary-strong: #0a3746;
  --accent: #e56b6f;
  --ok: #1b8a5a;
  --error: #b42318;
  --line: #d9d4cb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, #d5eadf 0, transparent 30%),
    radial-gradient(circle at left, #f8d6c4 0, transparent 28%),
    var(--bg);
}

.page {
  min-height: 100vh;
  padding: 2rem 1rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.page-auth {
  align-items: center;
}

.card {
  width: min(980px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 12px 35px rgba(17, 75, 95, 0.12);
}

.auth-card {
  width: min(420px, 100%);
}

h1,
h2 {
  margin-top: 0;
}

p {
  color: var(--muted);
}

.form-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.stack {
  display: grid;
  gap: 0.75rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

label {
  font-weight: 600;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 0.62rem 0.75rem;
  border: 1px solid #bcc5cf;
  border-radius: 8px;
  background: #fff;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  padding: 0.65rem 1rem;
  cursor: pointer;
}

button:hover {
  background: var(--primary-strong);
}

.button-ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.button-ghost:hover {
  background: #e7f1f4;
}

.status {
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  margin: 0.8rem 0;
  font-weight: 600;
}

.status-error {
  color: #fff;
  background: var(--error);
}

.status-success {
  color: #fff;
  background: var(--ok);
}

.course-section {
  margin-top: 1rem;
}

.hidden {
  display: none;
}

.course-list {
  display: grid;
  gap: 0.8rem;
}

.course-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem;
  background: #fff;
}

.course-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.course-main {
  display: grid;
  gap: 0.3rem;
  text-align: left;
  min-width: 0;
}

.course-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 42px;
  margin-top: 0.05rem;
  border: 2px solid #9fb0bf;
  border-radius: 10px;
  background: #f5f8fa;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.course-check-input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.course-check:hover {
  border-color: var(--primary);
  background: #eaf3f6;
}

.course-check:has(.course-check-input:focus-visible) {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(17, 75, 95, 0.2);
}

.course-item:has(.course-check-input:checked) .course-check,
.course-item.is-selected .course-check {
  border-color: #2f8f4e;
  background: #dff3e5;
}

.course-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.course-location {
  margin: 0.45rem 0;
}

.course-item:has(.course-check-input:checked),
.course-item.is-selected {
  background: #edf9f0;
  border-color: #93cfa2;
}

.prereq-row {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
}

.prereq-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.prereq-group {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.28rem 0.4rem;
  border: 1px solid #cfd8df;
  border-radius: 999px;
  background: #f8fafb;
}

.abbr-chip {
  display: inline-block;
  font-size: 0.86rem;
  font-weight: 700;
  color: #163b47;
  text-decoration: underline dotted;
  cursor: help;
}

.or-sep {
  color: #7b8794;
  font-weight: 700;
}

.actions {
  margin-top: 1.2rem;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 760px) {
  .form-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .course-head {
    align-items: center;
  }

  .actions {
    justify-content: stretch;
  }

  .actions button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .course-head {
    gap: 0.6rem;
  }

  .course-check {
    min-width: 34px;
    min-height: 34px;
    padding: 0.2rem;
    border-radius: 8px;
  }

  .course-check-input {
    width: 18px;
    height: 18px;
  }
}
