.plugin-index-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.plugin-index-controls input,
.plugin-index-controls select {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text);
  background: var(--color-surface);
}

.plugin-index-controls input {
  flex: 1;
  min-width: 0;
}

/* Five columns of free text are genuinely wider than a 1440px window, so this
   table stays a scroll container at every width rather than pushing the page
   sideways. (Below 45em it is restyled as cards and this no longer applies.) */
#plugin-table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#plugin-table .plugin-name {
  font-weight: 600;
}

/* Usage is the decision-relevant column; metadata columns (Maintainer/License/Version)
   stay in the table but read as secondary. */
#plugin-table .plugin-usage {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

#plugin-table td[data-label="Maintainer"],
#plugin-table td[data-label="License"],
#plugin-table td[data-label="Version"] {
  color: var(--color-text-muted);
  font-size: 0.9em;
}

.plugin-comment-wrap {
  position: relative;
  margin-top: 0.2rem;
}

#plugin-table .plugin-comment {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-clamp: 3;
  overflow: hidden;
  white-space: pre-line;
}

.plugin-comment-more {
  position: absolute;
  right: 0;
  bottom: 0;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  box-shadow: -0.6rem 0 0.4rem 0.1rem var(--color-surface);
}

.plugin-comment-more:hover {
  background: var(--color-sidebar);
  color: #fff;
  border-color: var(--color-sidebar);
}

.plugin-comment-popover {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(90vw, 42rem);
  max-height: 80vh;
  overflow-y: auto;
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.plugin-comment-popover::backdrop {
  background: rgba(0, 0, 0, 0.06);
}

.plugin-comment-popover-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 1.75rem;
  height: 1.75rem;
  line-height: 1;
  font-size: 1.2rem;
  font-family: var(--font-body);
  color: var(--color-text);
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  cursor: pointer;
}

.plugin-comment-popover-close:hover {
  background: var(--color-sidebar);
  color: #fff;
  border-color: var(--color-sidebar);
}

.plugin-comment-popover strong {
  display: block;
  margin-bottom: 0.5rem;
  padding-right: 1.5rem;
  color: var(--color-heading);
}

.plugin-comment-popover p {
  white-space: pre-line;
  font-size: 0.9rem;
  line-height: 1.5;
}

#plugin-empty-state {
  padding: 1rem 0;
  color: var(--color-text-muted);
}

/* ---------- Phone: each row becomes a card ---------- */

@media (max-width: 44.9375em) {
  .plugin-index-controls input,
  .plugin-index-controls select {
    flex-basis: 100%;
  }

  #plugin-table,
  #plugin-table tbody,
  #plugin-table tr,
  #plugin-table td {
    display: block;
    width: auto;
  }

  #plugin-table thead {
    display: none;
  }

  /* The filter script toggles `row.hidden`. Setting display:block on tr above
     overrides the user-agent [hidden] rule, so restate it or filtering breaks. */
  #plugin-table tr[hidden] {
    display: none !important;
  }

  #plugin-table tr {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.75rem;
    background: var(--color-surface);
  }

  #plugin-table td {
    border: 0;
    padding: 0.1rem 0;
    font-size: 0.85rem;
  }

  #plugin-table td[data-label] {
    display: flex;
    gap: 0.5rem;
  }

  #plugin-table td[data-label]::before {
    content: attr(data-label);
    flex: none;
    width: 6rem;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.7;
  }

  #plugin-table .plugin-name {
    font-size: 1rem;
  }

  /* Cards have room for the whole comment, so drop the clamp and its
     absolutely positioned "More" affordance. */
  #plugin-table .plugin-comment {
    display: block;
    overflow: visible;
    -webkit-line-clamp: none;
    line-clamp: none;
    margin-bottom: 0.4rem;
  }

  .plugin-comment-more {
    display: none;
  }
}
