.category-list,
.source-options,
.selected-list {
  display: grid;
  gap: 8px;
}

.source-options-horizontal {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.category-button,
.ghost-button,
.primary-button,
.secondary-button,
.selected-list button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.category-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  text-align: left;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

.category-button:hover {
  border-color: var(--line-strong);
  transform: translateX(2px);
}

.category-button strong {
  color: var(--muted);
  font-size: 0.78rem;
}

.category-button.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.source-option {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-transform: none;
}

.source-options-horizontal .source-option {
  min-height: 66px;
}

.source-option input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.source-option:has(input:checked) {
  border-color: rgb(14 107 88 / 36%);
  background: linear-gradient(180deg, #ffffff, #f3fbf8);
}

.source-option span {
  display: grid;
  gap: 2px;
}

.source-option strong {
  color: var(--text);
  font-size: 0.9rem;
}

.source-option small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

@media (max-width: 980px) {
  .source-options-horizontal {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .source-options-horizontal {
    grid-template-columns: 1fr;
  }
}

.app-card {
  display: grid;
  gap: 10px;
  min-height: 160px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 96%), rgb(250 252 253 / 96%)),
    var(--surface-raised);
  box-shadow: 0 1px 0 rgb(255 255 255 / 90%) inset;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.app-card:hover {
  border-color: rgb(14 107 88 / 34%);
  box-shadow: 0 14px 34px rgb(27 39 51 / 10%);
  transform: translateY(-2px);
}

.app-card.is-selected {
  border-color: var(--primary);
  background:
    linear-gradient(180deg, #ffffff, #eefaf5),
    var(--surface-raised);
  box-shadow: 0 18px 38px rgb(14 107 88 / 13%);
}

.app-toggle {
  display: grid;
  grid-template-columns: 50px 1fr 18px;
  gap: 12px;
  width: 100%;
  min-height: 94px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.app-icon {
  position: relative;
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, #ffffff, #eef3f7);
  border: 1px solid var(--line);
  color: #2d3846;
  font-size: 0.88rem;
  font-weight: 900;
  box-shadow: 0 8px 16px rgb(27 39 51 / 7%);
  overflow: hidden;
}

.app-icon img {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 27px;
  height: 27px;
  transform: translate(-50%, -50%);
  object-fit: contain;
  opacity: 1;
}

.app-icon:has(img) .icon-fallback {
  opacity: 0;
}

.icon-fallback {
  position: relative;
  z-index: 0;
  color: #607086;
  font-size: 0.78rem;
  font-weight: 900;
  transition: opacity 160ms ease;
}

.app-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.app-copy strong {
  overflow-wrap: anywhere;
  font-size: 0.96rem;
}

.app-copy small {
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.35;
}

.check-dot {
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}

.app-card.is-selected .check-dot {
  border-color: var(--primary);
  background: radial-gradient(circle at center, var(--primary) 0 45%, transparent 49%);
}

.source-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}

.source-tag {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.source-native {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.source-deb {
  background: var(--accent-soft);
  color: var(--accent);
}

.source-flatpak {
  background: var(--blue-soft);
  color: var(--blue);
}

.source-snap {
  background: var(--violet-soft);
  color: var(--violet);
}

.selected-list {
  max-height: 132px;
  overflow: auto;
}

.selected-list button {
  overflow: hidden;
  padding: 0 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-list button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.command-box {
  display: grid;
  gap: 7px;
}

.command-box code {
  display: block;
  overflow-x: auto;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101820;
  color: #e8f7ef;
  font-size: 0.83rem;
}

.script-preview {
  min-height: 260px;
  max-height: 430px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid #273240;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 3%), transparent 28%),
    #101820;
  color: #d9e8ef;
  font-size: 0.78rem;
  line-height: 1.55;
}

.primary-button,
.secondary-button,
.ghost-button {
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  flex: 1;
  border-color: var(--primary);
  background: linear-gradient(180deg, #138069, var(--primary));
  color: #ffffff;
  box-shadow: 0 10px 20px rgb(14 107 88 / 20%);
}

.secondary-button {
  min-width: 82px;
  background: var(--surface);
}

.catalog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.catalog-actions span {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.ghost-button {
  min-width: 76px;
  background: transparent;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}
