.icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  vertical-align: -0.3em;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
}

.icon--sm {
  width: 16px;
  height: 16px;
}

.button,
.button--primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 10px 16px;
  background: var(--color-button-primary);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast), opacity var(--transition-fast);
}

.button:hover,
.button--primary:hover {
  background: var(--color-button-primary-hover);
  color: #fff;
  text-decoration: none;
}

.button--secondary,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 10px 16px;
  background: var(--mshp-paper);
  color: var(--mshp-text);
  border: 1px solid var(--mshp-line);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
}

.button--secondary:hover,
.button-secondary:hover {
  background: var(--mshp-surface-2);
  color: var(--mshp-text);
  text-decoration: none;
}

.button--ghost,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 8px 12px;
  background: transparent;
  color: var(--mshp-text);
  border: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.button--ghost:hover,
.link-button:hover {
  background: var(--mshp-surface-2);
  color: var(--mshp-text);
  text-decoration: none;
}

.button--danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  background: var(--mshp-paper);
  color: var(--mshp-danger);
  border: 1px solid color-mix(in srgb, var(--mshp-danger) 35%, var(--mshp-line));
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
}

.button--danger:hover {
  background: #fff4f2;
}

.button--icon {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--mshp-blue);
  border: 1px solid var(--mshp-line);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.button--icon:hover {
  background: var(--mshp-sky);
  border-color: var(--mshp-sky);
  color: #fff;
  text-decoration: none;
}

a.button--icon {
  text-decoration: none;
}

.button--icon.button--danger {
  color: var(--mshp-danger);
  background: var(--mshp-paper);
}

.button--icon.button--danger:hover {
  background: var(--mshp-danger);
  border-color: var(--mshp-danger);
  color: #fff;
}

.button:disabled,
.button--primary:disabled,
.button--secondary:disabled,
.button.is-loading {
  opacity: 0.62;
  cursor: not-allowed;
}

.inline-form {
  display: inline;
}

.card,
.form-card,
.course-card {
  background: var(--color-card-bg);
  border: 1px solid var(--mshp-line);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
}

.form-card {
  max-width: 440px;
}

  .form-card.step-editor,
  .form-card.quiz-builder,
  .form-card.form-wide {
    max-width: none;
    margin-bottom: 1em;
  }

.course-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-4);
}

.course-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}

.course-card h2,
.course-card h3 {
  margin: 0 0 var(--space-2);
  font-size: 1.15rem;
}

.course-card a.title-link {
  color: var(--mshp-text);
  text-decoration: none;
}

.course-card a.title-link:hover {
  color: var(--mshp-sky-dark);
}

.form-card p,
.field {
  margin: 0 0 var(--space-4);
}

.form-card label,
.field label {
  display: block;
  font-weight: 700;
  color: var(--mshp-text);
  margin-bottom: var(--space-2);
  font-size: 14px;
}

.form-card input[type="text"],
  .form-card input[type="number"],
  .form-card input[type="email"],
  .form-card input[type="password"],
  .form-card input[type="url"],
  .form-card input[type="slug"],
  .form-card input[type="search"],
  .form-card input[type="file"],
  .form-card input[type="datetime-local"],
  .form-card textarea,
  .form-card select,
.input,
.filter-row select,
.filter-row input {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  font: inherit;
  color: var(--mshp-text);
  background: var(--mshp-paper);
  border: 1px solid var(--mshp-line);
  border-radius: var(--radius-md);
}

.form-card textarea,
.input--area {
  min-height: 96px;
  resize: vertical;
}

.form-card input:focus-visible,
.form-card textarea:focus-visible,
.form-card select:focus-visible,
.input:focus-visible {
  border-color: var(--mshp-sky);
}

.form-card input[type="checkbox"],
.form-card input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--mshp-sky);
}

.form-error,
.errorlist {
  color: var(--mshp-danger);
  padding-left: 16px;
  margin: var(--space-1) 0 0;
  font-size: 0.875rem;
}

.field.has-error input,
.field.has-error textarea,
.field.has-error select {
  border-color: var(--mshp-danger);
}

.badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 800;
  background: var(--mshp-surface-2);
  color: var(--mshp-text);
  border: 1px solid var(--mshp-line);
}

.status-badge--available { color: var(--mshp-sky-dark); background: var(--mshp-surface-3); }
.status-badge--current { color: var(--mshp-text); background: #e7f6ff; border-color: var(--mshp-sky); }
.status-badge--done,
.status-badge--success { color: var(--mshp-success); background: #e8f8f4; border-color: #bde8dc; }
.status-badge--locked { color: var(--mshp-muted); background: var(--mshp-surface); }
.status-badge--optional { color: var(--mshp-muted-strong); }
.status-badge--draft { color: var(--mshp-warning); background: #fff6eb; border-color: #ffd9a8; }
.status-badge--published { color: var(--mshp-success); background: #e8f8f4; }
.status-badge--new { color: var(--mshp-sky-dark); background: var(--mshp-surface-3); }
.status-badge--danger { color: var(--mshp-danger); background: #fff1ef; border-color: #f5c2bb; }

.progress {
  display: grid;
  gap: var(--space-2);
}

.progress-track {
  height: 8px;
  background: var(--mshp-surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--color-progress-done);
  border-radius: var(--radius-pill);
}

.progress-label {
  font-size: 0.875rem;
  color: var(--mshp-muted-strong);
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-5);
}

.message,
.flash {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  border: 1px solid var(--mshp-line);
  background: var(--mshp-paper);
}

.message-success,
.flash--success {
  background: #e8f8f4;
  color: var(--mshp-blue-deep);
  border-color: #bde8dc;
}

.message-error,
.flash--error {
  background: #fff1ef;
  color: var(--mshp-blue-deep);
  border-color: #f5c2bb;
}

.empty-state {
  text-align: center;
  padding: var(--space-10) var(--space-6);
  background: var(--mshp-paper);
  border: 1px dashed var(--mshp-line-strong);
  border-radius: var(--radius-2xl);
}

.empty-state .icon {
  width: 40px;
  height: 40px;
  color: var(--mshp-sky);
  margin-bottom: var(--space-3);
}

.empty-state h2 {
  margin-bottom: var(--space-2);
}

.empty-state p {
  color: var(--mshp-muted);
}

.user-chip,
.wallet-chip,
.avatar-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 12px;
  background: var(--mshp-surface-2);
  color: var(--mshp-text);
  border: 1px solid var(--mshp-line);
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 700;
}

.avatar-button {
  cursor: pointer;
  width: 44px;
  padding: 0;
  justify-content: center;
}

.help-card {
  background: var(--mshp-surface-3);
  border: 1px solid var(--mshp-line);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  color: var(--mshp-muted-strong);
}

.filter-row {
  display: flex;
  gap: var(--space-3);
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}

.filter-row label {
  font-weight: 700;
  color: var(--mshp-text);
  font-size: 14px;
}

.filter-row select {
  min-width: 200px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.summary-card {
  background: var(--mshp-paper);
  border: 1px solid var(--mshp-line);
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-5);
}

.summary-card .value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--mshp-text);
}

.summary-card .label {
  color: var(--mshp-muted);
  font-size: 0.9rem;
}

.thread {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-4);
  display: grid;
  gap: var(--space-3);
}

.thread-item,
.thread li {
  background: var(--mshp-paper);
  border: 1px solid var(--mshp-line);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
}

.prose {
  max-width: 72ch;
  color: var(--mshp-text-body);
}

.prose > *:first-child {
  margin-top: 0;
}

.prose a {
  color: var(--mshp-sky-dark);
}

.prose pre,
.prose code {
  font-family: var(--font-mono);
}

.prose :not(pre) > code {
  background: var(--mshp-surface-2);
  border: 1px solid var(--mshp-line);
  border-radius: 6px;
  padding: 0.15em 0.4em;
  font-size: 0.875em;
  color: var(--mshp-text);
}

.prose pre {
  position: relative;
  background: var(--mshp-blue-deep);
  color: #e8f3fa;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.45;
  tab-size: 4;
}

.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.85rem;
  color: inherit;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  cursor: zoom-in;
}

.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: rgba(29, 44, 57, 0.72);
}

.img-lightbox[hidden] {
  display: none;
}

.img-lightbox__dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  max-width: 100%;
  max-height: 100%;
}

.img-lightbox__img {
  display: block;
  max-width: min(96vw, 1400px);
  max-height: calc(96vh - 72px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: var(--mshp-paper);
}

.img-lightbox__caption {
  margin: 0;
  color: #fff;
  text-align: center;
}

.img-lightbox__close {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  background: var(--mshp-paper);
}

body.is-lightbox-open {
  overflow: hidden;
}

.prose .table-wrap,
.prose table {
  max-width: 100%;
}

.prose table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 0 0 var(--space-4);
}

.prose th,
.prose td {
  border: 1px solid var(--mshp-line);
  padding: 8px 12px;
  text-align: left;
}

.prose th {
  background: var(--mshp-surface);
  font-weight: 700;
}

.prose blockquote {
  margin: 0 0 var(--space-4);
  padding: 0 var(--space-4);
  border-left: 3px solid var(--mshp-sky);
  color: var(--mshp-muted-strong);
}

.copy-code {
  position: absolute;
  top: 8px;
  right: 8px;
}

.type-fields[hidden] {
  display: none !important;
}

.ui-kit-section {
  margin: 0 0 var(--space-10);
}

.ui-kit-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-4);
}

@media (max-width: 640px) {
  .course-card {
    flex-direction: column;
    align-items: flex-start;
  }
}
