.course-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.course-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 4px 12px rgb(0 87 168 / 5%);
  transition: transform .2s, box-shadow .2s;
}

.course-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.course-image {
  width: 100%;
  height: 190px;
  object-fit: cover;
  background: var(--primary-light);
}

.course-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 20px;
}

.course-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.course-title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.25;
}

.course-description {
  margin: 13px 0;
  color: var(--muted);
  font-size: .92rem;
}

.course-details {
  padding: 0;
  margin: 4px 0 20px;
  color: var(--muted);
  font-size: .87rem;
  list-style: none;
}

.course-details li {
  margin: 7px 0;
}

.course-actions {
  margin-top: auto;
}

.app-button {
  padding: 11px 16px;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  transition: background .2s, color .2s, transform .2s;
}

.app-button.primary {
  background: var(--primary);
  color: #fff;
}

.app-button.primary:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}

.app-button.secondary {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.app-button.secondary:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--primary);
}

.app-button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-aberto {
  background: #e7f7ed;
  color: var(--success);
}

.status-encerrado {
  background: #ffebee;
  color: var(--error);
}

.status-em-breve {
  background: var(--accent-soft);
  color: var(--warning);
}

.loading-wrap,
.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.spinner {
  width: 38px;
  height: 38px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #10182899;
  animation: fade .18s;
}

.modal {
  width: min(620px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 22px 60px #0004;
}

.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  padding: 24px 24px 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.45rem;
}

.modal-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.modal-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.6rem;
}

.registration-form {
  padding: 24px;
}

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

.form-field {
  display: grid;
  gap: 6px;
  font-size: .9rem;
  font-weight: 650;
}

.form-field input,
.form-field select {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
}

.form-field input:focus,
.form-field select:focus {
  border-color: var(--primary);
  outline: 3px solid rgb(0 87 168 / 14%);
}

.form-field.full {
  grid-column: 1 / -1;
}

.field-error {
  min-height: 18px;
  color: var(--error);
  font-size: .76rem;
  font-weight: 500;
}

.check-field {
  display: flex;
  align-items: start;
  gap: 9px;
  margin: 20px 0;
  font-size: .88rem;
}

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

.toast-container {
  position: fixed;
  z-index: 30;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
}

.toast {
  max-width: 360px;
  padding: 14px 18px;
  border-radius: 12px;
  color: #fff;
  box-shadow: var(--shadow);
  animation: toast .2s;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--error);
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes toast {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.receipt {
  padding: 14px 0 8px;
  text-align: center;
}

.receipt h3 {
  margin: 6px 0;
  font-size: 1.35rem;
}

.receipt dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  padding: 18px;
  border-radius: 12px;
  background: var(--card);
  text-align: left;
}

.receipt dt {
  font-weight: 700;
}

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

.qr-code {
  width: 155px;
  height: 155px;
  margin: 12px auto;
  image-rendering: pixelated;
}

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

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

  .form-field.full {
    grid-column: auto;
  }

  .course-image {
    height: 175px;
  }

  .modal-header,
  .registration-form {
    padding-right: 18px;
    padding-left: 18px;
  }
}
