.tool-category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 20px;
}

.tool-filter-chip {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: #475569;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease;
}

.tool-filter-chip:hover,
.tool-filter-chip.active {
  color: var(--purple);
  border-color: #d7c8ff;
  background: var(--purple-soft);
}

.tool-filter-chip:hover { transform: translateY(-1px); }

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

.tool-card {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tool-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.tool-logo-wrap {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(15, 23, 42, .05);
}

.tool-logo-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tool-card-copy { flex: 1; }
.tool-card-copy h2 { margin-bottom: 7px; font-size: 20px; }
.tool-card-copy p { margin: 0; color: var(--slate); font-size: 13px; line-height: 1.65; }
.tool-card-footer { display: grid; gap: 9px; margin-top: auto; }
.tool-card-footer .btn .icon { width: 16px; height: 16px; }

.affiliate-disclosure {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  text-align: center;
}

.tool-empty-state {
  grid-column: 1 / -1;
  padding: 52px 24px !important;
  text-align: center;
}

.tool-empty-state p {
  max-width: 460px;
  margin: 0 auto 16px;
  color: var(--slate);
}

.tool-empty-state .btn { margin: 0 auto; }

.tool-admin-heading {
  align-items: flex-end;
}

.tool-admin-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.tool-admin-summary span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--slate);
  background: #fff;
  font-size: 10px;
  font-weight: 600;
}

.tool-admin-summary strong {
  color: var(--navy);
}

.tool-admin-card {
  overflow: hidden;
}

.tool-admin-table-wrap {
  overflow-x: auto;
}

.tool-admin-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
}

.tool-admin-table th,
.tool-admin-table td {
  vertical-align: middle;
}

.tool-admin-table th:nth-child(1) { width: 37%; }
.tool-admin-table th:nth-child(2) { width: 10%; }
.tool-admin-table th:nth-child(3) { width: 23%; }
.tool-admin-table th:nth-child(4) { width: 7%; }
.tool-admin-table th:nth-child(5) { width: 10%; }
.tool-admin-table th:nth-child(6) { width: 13%; }

.tool-admin-table tbody tr {
  transition: background .16s ease;
}

.tool-admin-table tbody tr:hover {
  background: #fbfaff;
}

.tool-admin-tool-cell {
  padding-top: 14px !important;
  padding-bottom: 14px !important;
}

.tool-admin-name {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tool-admin-name img {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  object-fit: contain;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}

.tool-admin-copy {
  min-width: 0;
}

.tool-admin-copy strong {
  display: block;
  margin-bottom: 3px;
  overflow: hidden;
  color: var(--navy);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-admin-copy small {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tool-category-badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-admin-affiliate {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.tool-admin-affiliate a {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--navy);
}

.tool-admin-affiliate a:hover strong {
  color: var(--purple);
}

.tool-admin-affiliate strong {
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color .16s ease;
}

.tool-admin-affiliate .icon {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  color: var(--muted);
}

.tool-admin-affiliate small {
  display: block;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-order-col {
  text-align: center;
}

.tool-order-badge {
  min-width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #475569;
  background: #f8fafc;
  font-size: 10px;
  font-weight: 700;
}

.tool-status-form {
  margin: 0;
}

.tool-status-toggle {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.tool-status-toggle:hover {
  transform: translateY(-1px);
}

.tool-status-toggle.is-visible {
  border-color: #bbf7d0;
  color: #15803d;
  background: #ecfdf3;
}

.tool-status-toggle.is-hidden {
  border-color: #e2e8f0;
  color: #64748b;
  background: #f8fafc;
}

.tool-status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.tool-admin-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.tool-action-button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: #475569;
  background: #fff;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  transition: color .16s ease, border-color .16s ease, background .16s ease, transform .16s ease;
}

.tool-action-button:hover {
  color: var(--purple);
  border-color: #d7c8ff;
  background: var(--purple-soft);
  transform: translateY(-1px);
}

.tool-action-button.danger {
  color: #b91c1c;
  border-color: #fecaca;
}

.tool-action-button.danger:hover {
  color: #b91c1c;
  border-color: #fca5a5;
  background: #fff1f2;
}

.tool-action-button .icon {
  width: 14px;
  height: 14px;
}

.tool-form-card { max-width: 900px; }
.tool-delete-actions { margin-top: 18px; }

@media (max-width: 1180px) {
  .tool-admin-table {
    min-width: 900px;
  }

  .tool-admin-table th:nth-child(1) { width: 34%; }
  .tool-admin-table th:nth-child(3) { width: 24%; }

  .tool-action-button span {
    display: none;
  }

  .tool-action-button {
    width: 34px;
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 1080px) {
  .tool-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .tool-card-grid { grid-template-columns: 1fr; }
  .tool-category-filter {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }
  .tool-filter-chip { flex: 0 0 auto; }
  .tool-card { gap: 15px; }
  .tool-logo-wrap { width: 58px; height: 58px; }
  .tool-card-copy h2 { font-size: 18px; }

  .tool-admin-heading {
    align-items: flex-start;
  }

  .tool-admin-summary {
    margin-top: 8px;
  }
}
