:root {
  color-scheme: light;
  --ink: #182230;
  --muted: #667085;
  --line: #d8dee9;
  --panel: #ffffff;
  --canvas: #f2f4f7;
  --navy: #101828;
  --blue: #155eef;
  --blue-dark: #004eeb;
  --danger: #d92d20;
  --hour-height: 64px;
  --calendar-height: 768px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(21, 94, 239, 0.09), transparent 25rem),
    var(--canvas);
}

button {
  font: inherit;
}

.topbar {
  min-height: 92px;
  padding: 18px clamp(18px, 3vw, 42px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: white;
  background: var(--navy);
  border-bottom: 4px solid var(--blue);
}

.topbar h1,
.topbar p {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(1.55rem, 2.6vw, 2.3rem);
  letter-spacing: -0.035em;
}

.eyebrow {
  margin-bottom: 3px !important;
  color: #b2ccff;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 750;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

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

.button:focus-visible,
.option-card:focus-visible,
.event-block:focus-visible {
  outline: 3px solid #84adff;
  outline-offset: 2px;
}

.button-primary {
  color: white;
  background: var(--blue);
}

.button-primary:hover {
  background: var(--blue-dark);
}

.button-ghost {
  color: white;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.24);
}

.button-small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.78rem;
  color: #344054;
  background: white;
  border-color: #cfd6e2;
}

.app-shell {
  width: min(1720px, 100%);
  margin: 0 auto;
  padding: 22px clamp(14px, 2.5vw, 34px) 34px;
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(720px, 1fr);
  gap: 18px;
  align-items: start;
}

.catalog-panel,
.calendar-panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(208, 213, 221, 0.9);
  border-radius: 16px;
  box-shadow: 0 12px 34px rgba(16, 24, 40, 0.07);
}

.catalog-panel {
  padding: 18px;
}

.panel-heading,
.calendar-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.panel-heading h2,
.panel-heading p,
.calendar-toolbar h2,
.calendar-toolbar p {
  margin: 0;
}

.panel-heading h2,
.calendar-toolbar h2 {
  font-size: 1.12rem;
}

.panel-heading p,
.calendar-toolbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.4;
}

.progress-pill {
  flex: 0 0 auto;
  padding: 6px 9px;
  color: #1849a9;
  background: #eff4ff;
  border: 1px solid #d1e0ff;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
}

.selection-status {
  margin: 14px 0 5px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.status-chip {
  padding: 5px 8px;
  border-radius: 7px;
  color: #475467;
  background: #f2f4f7;
  font-size: 0.7rem;
  font-weight: 750;
}

.status-chip.done {
  color: #067647;
  background: #ecfdf3;
}

.catalog {
  display: grid;
  gap: 14px;
}

.course-section {
  padding-top: 13px;
  border-top: 1px solid #eaecf0;
}

.course-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 8px;
}

.course-heading h3 {
  margin: 0;
  font-size: 0.87rem;
  line-height: 1.25;
}

.course-heading span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.option-list {
  display: grid;
  gap: 7px;
}

.option-card {
  position: relative;
  padding: 10px;
  display: grid;
  grid-template-columns: 5px 1fr auto;
  gap: 9px;
  align-items: center;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  background: #fff;
  cursor: grab;
  text-align: left;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.option-card:hover {
  border-color: #98a2b3;
  box-shadow: 0 5px 15px rgba(16, 24, 40, 0.08);
  transform: translateY(-1px);
}

.option-card.selected {
  border-color: #84adff;
  background: #f5f8ff;
}

.option-card.dragging {
  opacity: 0.55;
}

.option-swatch {
  align-self: stretch;
  min-height: 36px;
  border-radius: 5px;
  background: var(--option-color);
}

.option-title {
  display: block;
  margin-bottom: 3px;
  font-size: 0.79rem;
  font-weight: 820;
}

.option-meta {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.35;
}

.option-action {
  min-width: 54px;
  padding: 5px 7px;
  color: #344054;
  background: #f9fafb;
  border: 1px solid #d0d5dd;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 800;
}

.option-card.selected .option-action {
  color: #b42318;
  background: #fff;
  border-color: #fecdca;
}

.legend-card {
  margin-top: 16px;
  padding: 12px;
  color: #475467;
  background: #f8f9fc;
  border: 1px solid #eaecf0;
  border-radius: 10px;
}

.legend-card h3,
.legend-card p {
  margin: 0;
}

.legend-card h3 {
  color: #344054;
  font-size: 0.78rem;
}

.legend-card p {
  margin-top: 6px;
  font-size: 0.71rem;
  line-height: 1.45;
}

.calendar-panel {
  overflow: hidden;
}

.calendar-toolbar {
  min-height: 74px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.calendar-key {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 0.7rem;
}

.calendar-key span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
}

.dot-every {
  background: #12b76a;
}

.dot-irregular {
  background: #f79009;
}

.calendar-scroll {
  overflow: auto;
}

.calendar {
  min-width: 760px;
  display: grid;
  grid-template-columns: 64px repeat(5, minmax(135px, 1fr));
  grid-template-rows: 44px var(--calendar-height);
  background: white;
}

.calendar-corner,
.day-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  color: #475467;
  background: #f8f9fc;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  font-size: 0.73rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.time-axis {
  position: relative;
  height: var(--calendar-height);
  background: #f8f9fc;
  border-right: 1px solid var(--line);
}

.time-label {
  position: absolute;
  right: 9px;
  transform: translateY(-50%);
  color: #667085;
  font-size: 0.67rem;
  font-variant-numeric: tabular-nums;
}

.day-column {
  position: relative;
  height: var(--calendar-height);
  border-right: 1px solid var(--line);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--hour-height) / 2 - 1px),
      #eef1f5 calc(var(--hour-height) / 2 - 1px),
      #eef1f5 calc(var(--hour-height) / 2),
      transparent calc(var(--hour-height) / 2),
      transparent calc(var(--hour-height) - 1px),
      #d8dee9 calc(var(--hour-height) - 1px),
      #d8dee9 var(--hour-height)
    );
}

.day-column.drop-target {
  background-color: #eff4ff;
}

.event-block {
  position: absolute;
  z-index: 5;
  min-height: 38px;
  padding: 7px 26px 6px 8px;
  color: #17212f;
  background: color-mix(in srgb, var(--event-color) 17%, white);
  border: 1px solid color-mix(in srgb, var(--event-color) 60%, #667085);
  border-left: 5px solid var(--event-color);
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(16, 24, 40, 0.12);
  cursor: grab;
  overflow: hidden;
  transition: box-shadow 120ms ease, transform 120ms ease;
}

.event-block:hover {
  z-index: 9;
  box-shadow: 0 8px 22px rgba(16, 24, 40, 0.2);
  transform: translateY(-1px);
}

.event-block.conflict {
  z-index: 8;
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(217, 45, 32, 0.18), 0 6px 16px rgba(16, 24, 40, 0.14);
}

.event-block.irregular::after {
  content: "";
  position: absolute;
  inset: auto 7px 6px auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f79009;
}

.event-code,
.event-time,
.event-detail {
  display: block;
  pointer-events: none;
}

.event-code {
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.1;
}

.event-time {
  margin-top: 2px;
  font-size: 0.67rem;
  font-weight: 750;
}

.event-detail {
  margin-top: 2px;
  color: #475467;
  font-size: 0.61rem;
  line-height: 1.2;
}

.event-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  padding: 0;
  display: grid;
  place-items: center;
  color: #475467;
  background: rgba(255, 255, 255, 0.72);
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.event-delete:hover {
  color: #b42318;
  background: white;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 100;
  max-width: min(420px, calc(100% - 28px));
  padding: 10px 14px;
  color: white;
  background: #101828;
  border-radius: 9px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.25);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  font-size: 0.8rem;
  font-weight: 700;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 700px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .button {
    flex: 1;
  }

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

  .calendar-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .calendar-key {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
