:root {
  color-scheme: light;
  --bg: #FAF9F5;
  --surface: #FFFFFF;
  --surface-strong: #F6F0E6;
  --text: #141413;
  --muted: #3D3D3A;
  --muted-soft: #87867F;
  --accent: #D97757;
  --accent-soft: rgba(217, 119, 87, 0.12);
  --border: #E3DACC;
  --shadow: 0 4px 10px rgba(20, 20, 19, 0.04), 0 1px 2px rgba(20, 20, 19, 0.02);
  --radius: 12px;
  --font: 'Inter', 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
select,
input,
textarea {
  font: inherit;
}

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

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 32px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 2.6vw, 3.2rem);
  line-height: 1.18;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0.85rem 0 0;
  max-width: 64ch;
  color: var(--muted);
  line-height: 1.8;
  font-weight: 400;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.content > section {
  margin-bottom: 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.card-hero {
  background: var(--surface);
}

.card-header h2 {
  margin: 0 0 0.75rem;
  font-size: 1.55rem;
  line-height: 1.25;
  font-weight: 600;
}

.card-header p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
}

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

.field,
.section-footer {
  margin-top: 24px;
}

.field label,
.field > label {
  display: grid;
  gap: 10px;
}

.field span,
.field .field-label,
.section-footer .hint {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

input[type="text"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  background: #FFFFFF;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  min-height: 44px;
}

textarea {
  min-height: 128px;
  resize: vertical;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 6px var(--accent-soft);
}

select {
  appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text) 50%), linear-gradient(135deg, var(--text) 50%, transparent 50%);
  background-position: right 14px center, right 10px center;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

select option {
  color: var(--text);
  background: #FFFFFF;
}

.custom-select {
  position: relative;
}

.custom-select-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #FCF7F0;
  color: var(--text);
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
}

.custom-select-toggle:hover {
  background: #F5EEE5;
}

.custom-select-dot,
.custom-option-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.custom-select-value {
  flex: 1;
  text-align: left;
}

.custom-select-icon {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.95rem;
}

.custom-select-list {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 1000;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #FFFFFF;
  box-shadow: 0 10px 24px rgba(20, 20, 19, 0.08);
  list-style: none;
  padding: 8px 0;
  margin: 0;
  max-height: 260px;
  overflow: auto;
  min-width: 200px;
}

.custom-select-list[hidden] {
  display: none;
}

.custom-select-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text);
}

.custom-select-item:hover,
.custom-select-item:focus {
  outline: none;
  background: rgba(217, 119, 87, 0.08);
}

.custom-select-item span:last-child {
  flex: 1;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease, opacity 0.18s ease;
  text-decoration: none;
  box-shadow: 0 2px 5px rgba(20, 20, 19, 0.05);
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary,
.button {
  background: var(--accent);
  color: #FFFFFF;
}

.button.primary:hover,
.button:hover {
  opacity: 0.95;
}

.button.outline,
.button.danger {
  box-shadow: none;
}

.button.outline {
  background: transparent;
  color: var(--accent);
  border-color: rgba(217, 119, 87, 0.24);
}

.button.outline:hover {
  background: rgba(217, 119, 87, 0.08);
}

.button.solid {
  background: #141413;
  color: #ffffff;
}

.button.small {
  padding: 10px 14px;
  font-size: 0.92rem;
}

.button.large {
  width: 100%;
  padding: 14px 18px;
  font-size: 1rem;
}

.module-add-row {
  margin-top: 24px;
}

.module-card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.module-card-header > div {
  min-width: 0;
}

.button.danger {
  background: transparent;
  color: #8C4A36;
  border-color: rgba(140, 74, 54, 0.16);
}

.button.danger:hover {
  color: #6F382A;
  background: rgba(140, 74, 54, 0.08);
  text-decoration: underline;
  opacity: 0.95;
}

.button.danger:hover {
  color: var(--text);
  background: rgba(20, 20, 19, 0.04);
}

.list-stack,
.mo-list,
.assessment-list,
.material-list,
.checkbox-grid {
  display: grid;
  gap: 18px;
}

.list-item,
.module-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

.list-item-header,
.subsection-header {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.subheading {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
  font-weight: 600;
}

.field-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.field-note.hidden {
  display: none;
}

.collapsible-card {
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: visible;
  background: #FFFFFF;
}

.collapsible-card .card-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #FFFFFF;
  border: none;
  padding: 22px 24px;
  text-align: left;
  cursor: pointer;
}

.collapsible-card .card-toggle:hover {
  background: rgba(217, 119, 87, 0.05);
}

.collapsible-card .card-toggle .subheading {
  margin: 0;
}

.collapsible-card .collapsible-content {
  padding: 0 24px 24px;
}

.collapsible-card.collapsed .collapsible-content {
  display: none;
}

.toggle-icon {
  font-size: 1rem;
  color: var(--muted);
}

.module-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
  margin-top: 20px;
}

@media (min-width: 980px) {
  .module-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.module-column {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  min-height: 220px;
  box-shadow: var(--shadow);
}

.column-header {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--text);
}

.column-header > span {
  font-weight: 600;
}

.column-header > button {
  justify-self: start;
}

.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill-button {
  border: 1px solid rgba(20, 20, 19, 0.08);
  border-radius: 999px;
  background: #F8F4EE;
  color: var(--text);
  padding: 10px 16px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  font-weight: 500;
  font-size: 0.95rem;
  min-width: 84px;
  text-align: center;
}

.pill-button:hover {
  background: rgba(217, 119, 87, 0.08);
  border-color: rgba(217, 119, 87, 0.24);
}

.pill-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.field-note.note-warning,
.module-clo-warning,
.mo-unassigned,
.assessment-mos-warning,
.clo-unassigned {
  color: var(--accent);
}

.vague-warning {
  color: #CC7B65;
}

.checkbox-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.checkbox-card {
  background: #FBF6EE;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(217, 119, 87, 0.14);
  display: flex;
  align-items: center;
  gap: 12px;
}

.checkbox-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.notice-card {
  background: #FFF8F2;
  border: 1px solid rgba(217, 119, 87, 0.15);
  border-radius: 16px;
  padding: 22px;
  color: var(--muted);
}

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

.notice-item {
  padding: 16px 18px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  color: var(--muted);
}

.module-card {
  position: relative;
}

.module-card.invalid {
  border-color: rgba(217, 119, 87, 0.35);
  box-shadow: 0 0 0 1px rgba(217, 119, 87, 0.12);
}

.module-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.assessment-item,
.material-item {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 1px solid rgba(20, 20, 19, 0.05);
}

.material-item {
  overflow: visible;
}

.assessment-item::before,
.material-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  background: transparent;
}

.field-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

@media (max-width: 860px) {
  .form-grid,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 28px;
  }

  .page-shell {
    width: min(100%, calc(100% - 32px));
  }
}

.assessment-item.discussion::before,
.material-item.reading::before {
  background: #C99076;
}

.assessment-item.quiz-exam::before,
.material-item.lecture-video::before {
  background: #D9B27B;
}

.assessment-item.written-assignment::before,
.material-item.other-video::before {
  background: #B9BE9A;
}

.assessment-item.interactive-activity::before,
.material-item.website::before {
  background: #9FAFC6;
}

.assessment-item.other::before,
.material-item.interactive-object::before {
  background: #A89EA8;
}
