#semantic-search-panel {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 2147483647;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  color: #1f2937;
  pointer-events: none;
}

#semantic-search-panel[data-state="collapsed"] #ssp-body {
  display: none;
}

#semantic-search-panel[data-state="open"] #ssp-body {
  display: flex;
}

#ssp-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #111827;
  color: #f9fafb;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  font-size: 13px;
  font-weight: 500;
  pointer-events: auto;
}

#ssp-toggle:hover {
  background: #1f2937;
}

.ssp-toggle-icon {
  font-size: 16px;
  line-height: 1;
}

#semantic-search-panel[data-state="open"] #ssp-toggle {
  display: none;
}

#ssp-body {
  width: 420px;
  max-height: calc(100vh - 80px);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: absolute;
  bottom: 0;
  right: 0;
  pointer-events: auto;
}

#ssp-body header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  margin-bottom: 10px;
}

#ssp-body h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  align-self: center;
}

#ssp-close {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  color: #6b7280;
}

#ssp-close:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.ssp-subtitle {
  grid-column: 1 / -1;
  font-size: 11px;
  color: #6b7280;
  margin: 0;
}

#ssp-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

#ssp-query {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  box-sizing: border-box;
}

#ssp-query:focus {
  outline: none;
  border-color: #76b900;
  box-shadow: 0 0 0 2px rgba(118, 185, 0, 0.18);
}

.ssp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ssp-row label {
  font-size: 12px;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ssp-row input[type="number"] {
  width: 56px;
  padding: 4px 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 12px;
}

#ssp-submit {
  padding: 6px 14px;
  background: #76b900;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 12px;
}

#ssp-submit:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

#ssp-submit:hover:not(:disabled) {
  background: #5d9100;
}

.ssp-status {
  font-size: 11px;
  color: #6b7280;
  min-height: 14px;
  margin-bottom: 6px;
}

.ssp-status.error {
  color: #b91c1c;
}

#ssp-results {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

#ssp-results li {
  padding: 10px 4px;
  border-top: 1px solid #f3f4f6;
  cursor: pointer;
}

#ssp-results li:hover {
  background: #f9fafb;
}

#ssp-results li.active {
  background: #f3f8e8;
  box-shadow: inset 3px 0 0 #76b900;
}

#ssp-results li.active:hover {
  background: #edf6dc;
}

.ssp-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 10px;
}

.ssp-badge {
  background: #eef2ff;
  color: #3730a3;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.ssp-badge.score {
  background: #ecfdf5;
  color: #065f46;
  font-variant-numeric: tabular-nums;
}

.ssp-badge.license {
  background: #f3f4f6;
  color: #374151;
}

.ssp-badge.pending {
  background: #f8fafc;
  color: #64748b;
}

.ssp-result-text {
  font-size: 12px;
  line-height: 1.45;
  color: #1f2937;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ssp-result-text.pending {
  color: #64748b;
  font-style: italic;
}

#ssp-results li.expanded .ssp-result-text {
  -webkit-line-clamp: unset;
  display: block;
}
