.market-section {
  padding: 18px 0 80px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: var(--settings-text-primary);
}

.market-section__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.market-section__title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.market-section__desc {
  margin: 0;
  font-size: 13px;
  color: var(--settings-text-secondary);
  max-width: 640px;
  line-height: 1.5;
}

.market-section__header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.market-section__refresh-btn {
  min-width: 92px;
}

.settings-app .market-section__refresh-btn--refreshing,
.settings-app .market-section__refresh-btn--success,
.settings-app .market-section__refresh-btn--failed {
  border-color: rgba(10, 132, 255, 0.22);
  background: rgba(10, 132, 255, 0.1);
  color: var(--settings-accent);
  box-shadow: 0 8px 20px rgba(10, 132, 255, 0.12);
}

.settings-app .market-section__refresh-btn--success {
  border-color: rgba(52, 199, 89, 0.28);
  background: rgba(52, 199, 89, 0.12);
  color: var(--settings-status-active);
  box-shadow: 0 8px 20px rgba(52, 199, 89, 0.1);
}

.settings-app .market-section__refresh-btn--failed {
  border-color: rgba(255, 59, 48, 0.28);
  background: rgba(255, 59, 48, 0.1);
  color: var(--settings-danger);
  box-shadow: 0 8px 20px rgba(255, 59, 48, 0.08);
}

.market-section__refresh-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: market-refresh-spin 0.75s linear infinite;
}

.market-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--settings-card-border);
  background: var(--settings-card-bg);
  box-shadow: var(--settings-shadow-soft);
}

.market-banner--warn {
  border-color: rgba(255, 149, 0, 0.35);
  background: rgba(255, 149, 0, 0.08);
}

.market-banner--info {
  border-color: rgba(10, 132, 255, 0.28);
  background: rgba(10, 132, 255, 0.07);
}

.market-banner__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.market-banner__body strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--settings-text-primary);
}

.market-banner__body span {
  font-size: 12px;
  color: var(--settings-text-secondary);
  line-height: 1.5;
}

.market-section__toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.market-section__toolbar .glass-input {
  flex: 1;
}

.market-section__sort {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--settings-card-border);
  background: var(--settings-card-bg);
  color: var(--settings-text-primary);
  font-size: 13px;
  cursor: pointer;
}

.market-section__sort:focus-visible {
  outline: 2px solid var(--settings-accent);
  outline-offset: 1px;
}

.market-section__state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 36px 24px;
  border-radius: 14px;
  border: 1px dashed var(--settings-card-border);
  background: var(--settings-card-bg);
  font-size: 13px;
  color: var(--settings-text-secondary);
}

.market-section__state--error {
  border-color: rgba(255, 59, 48, 0.4);
  background: rgba(255, 59, 48, 0.06);
  color: var(--settings-danger);
}

.market-section__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.market-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.market-card__top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.market-card__thumb {
  flex-shrink: 0;
  border-radius: 10px;
  background-color: rgba(120, 130, 145, 0.12);
}

.market-card__meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.market-card__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.market-card__name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--settings-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
}

.market-card__installed-pill {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--settings-status-active);
  border-radius: 999px;
  padding: 2px 8px;
}

.market-card__author {
  font-size: 12px;
  color: var(--settings-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-card__stats {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 11px;
  color: var(--settings-text-tertiary);
}

.market-card__kind {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(120, 130, 145, 0.12);
  color: var(--settings-text-secondary);
  text-transform: capitalize;
}

.market-card__desc {
  margin: 0;
  font-size: 12px;
  color: var(--settings-text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.market-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.market-card__tag {
  font-size: 11px;
  color: var(--settings-accent);
  background: var(--settings-accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

.market-card__actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.market-card__actions .glass-btn {
  flex: 1;
}

.market-card__actions .glass-btn:last-child {
  flex: 0 1 auto;
}

.market-card__job {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 12px;
  border: 1px solid rgba(10, 132, 255, 0.18);
  border-radius: 10px;
  background: rgba(10, 132, 255, 0.07);
}

.market-card__job-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.market-card__job-label,
.market-card__job-status {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}

.market-card__job-label {
  min-width: 0;
  overflow: hidden;
  color: var(--settings-text-primary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-card__job-status {
  flex-shrink: 0;
  color: var(--settings-accent);
}

.market-card__progress {
  position: relative;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.14);
}

.market-card__progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: var(--settings-accent-gradient);
  animation: market-card-progress 1.15s ease-in-out infinite;
}

.market-card__job--success {
  border-color: rgba(52, 199, 89, 0.26);
  background: rgba(52, 199, 89, 0.08);
}

.market-card__job--success .market-card__job-status {
  color: var(--settings-status-active);
}

.market-card__job--success .market-card__progress {
  background: rgba(52, 199, 89, 0.14);
}

.market-card__job--success .market-card__progress-bar {
  width: 100%;
  background: var(--settings-status-active);
  animation: none;
}

.market-card__job--failed {
  border-color: rgba(255, 59, 48, 0.26);
  background: rgba(255, 59, 48, 0.07);
}

.market-card__job--failed .market-card__job-status,
.market-card__job-error {
  color: var(--settings-danger);
}

.market-card__job--failed .market-card__progress {
  background: rgba(255, 59, 48, 0.14);
}

.market-card__job--failed .market-card__progress-bar {
  width: 100%;
  background: var(--settings-danger);
  animation: none;
}

.market-card__job-error {
  max-height: 132px;
  overflow: auto;
  font-size: 11px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}

@keyframes market-card-progress {
  0% {
    transform: translateX(-105%);
  }
  50% {
    transform: translateX(75%);
  }
  100% {
    transform: translateX(240%);
  }
}

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